Skip to content


Export File name in servlet/jsp

Posted in Internet, J2EE, Java, Technology.

While giving a link for export as a file, you may also want to give it a name that should come in save-as dialog or browser. To do so, you have to just set Content-Disposition header and content type of response
e.g. for saving as an excel file, following can be used:
response.setHeader(“Content-Disposition”,”attachment; filename=”" + filename + “”");
response.setContentType(“application/vnd.ms-excel”);

Note from Author :
I maintain my website, write articles and reply comments because of my interest/hobby to share information and knowledge.

If you liked the post, Please
Follow me on twitter: http://twitter.com/pankajbatracom
Join My facebook page: http://www.facebook.com/pankajbatra.blog
Join me on LinkedIn: http://www.linkedin.com/in/batrapankaj
Or subscribe to updates by Email by clicking here

To subscribe for updates, Enter your email address:

Related posts:

  1. Facebook Email in response to Google Gmail Buzz
  2. How to enable File Name completion on command prompt
  3. Email Marketing Tool Application
  4. BharatStudent-BullShit
  5. File sharing in Windows XP Professional


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.







Some HTML is OK

or, reply to this post via trackback.