aspose file tools*
The moose likes Servlets and the fly likes setting file name for creating a data file via servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "setting file name for creating a data file via servlet" Watch "setting file name for creating a data file via servlet" New topic
Author

setting file name for creating a data file via servlet

steve lopez
Greenhorn

Joined: Nov 02, 2001
Posts: 2
I have created a Servlet/JSP solution that allows the user to save data from MySQL as tab-delimited file.
What I do not know is how to programmatically set the default name for the file when the user does a 'Save As'. I recall seeing a solution to this awhile back but cannot find the reference.
Thanks!
Steve
steve lopez
Greenhorn

Joined: Nov 02, 2001
Posts: 2
Please disregard! I just found my answer in a previous post (guess I didn't search thoroughly enough the first time).
The answer is:
response.setHeader("Content-Disposition","attachment;filename="ALLRESULT.CSV");
Thanks,
Steve
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

No, thank you for getting back to us so that it doesn't waste anyone's time and provides an answer for others looking for it

Dave
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: setting file name for creating a data file via servlet