Tiana Zhang wrote,

> I created a servlet and hosted it on my machine. One of the functions of
this
> servlet is to save an output generated by the servlet to a client's
machine.
> In my servlet, when user enter the directory which he/she wants to save
the
> file(e,g C:\temp\), the file will be saved in that dir.

I am assuming that you want to save the file on the client machine. If this
is not correct, pl. disregard rest of the mail.


> The weird thing is that file has been saved in my machines instead of the
> client's local box.

Your code is written to save the file. The code executes on the server side
in a servlet container and hence it is saved on your machine.

> Can anyone tell me how to fix it?

You do not need to write the code to save the file. You can just stream the
file to the client. On receiving the file, the client (browser) will display
a dialog box asking to open the file or save it and the user uses this
facility to save the file. The user should enter the location he want to
save to in this dialog box. Your servlet does not need to know about the
location of save. (Does it?? )


> The code to save the file is:

I don't think you need this code.
The code/tips for streaming the file to a client is there in the archives
many times over.

>
> Thanks very much
> Tiana

regds,
Gokul

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to