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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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
 
jQuery in Action, 2nd edition
 
subject: setting file name for creating a data file via servlet
 
Similar Threads
jsp file name issue
File download Problem
CREATING FILE FROM SERVLET
Cannot get Netscape 6.1 to open save as dialog box
Save File on Client Machine