0

In servlet I can write

  response.getOutputStream().write(bytes);

So that the file is available to download by user.

But how would I go about it where I'm generating a file in side a applet ?

It is possible if user give a path to save then i can do

OutputStream outputStream = new FileOutputStream(pathtoSave);

But I don't want to prompt user for a path.

Any help regarding this ?

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307

1 Answers1

1

But I don't want to prompt user for a path.

Put it in a sub-directory of user.home1. Then after it is saved I strongly advise to display it to the user, using the Desktop2 API (so they can know where it is).

  1. As described in this answer to "Java Applet Download File".
  2. As described in this answer to "How can I display an HTML file as a web page?".
Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433