Take a look at org.apache.struts.actions.DownloadAction, I created an
action that extended it (and implemented the internal StreamInfo) and
was able to create an action that downloaded a PDF doc in less than an
hour.

For creating a new file to stream, one approach is to create the temp
file using (untested, of course):
 File dir = new
File(request.getSession().getServletContext().getRealPath("."));
 File tmp = File.createTempFile("web",null,dir);
 tmp.deleteOnExit();
You may not have rights to write to the web server's root directory,
you might be able to get away with "File tmp =
File.createTempFile("web", null);"
Store the data to this temp file, passing the file as a stream in the
aformentioned StreamInfo object. To eliminate creating the temp file,
stream the file directly without having an intermediate file.

-ed

On 6/22/06, Kavita Mehta <[EMAIL PROTECTED]> wrote:
my requirement is to save some lines on the server in a file and then
download it to the client's PC .  can anybdy suggest how to go abt it ....
thanks
Kavita

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to