jQuery in Action, 3rd edition
The moose likes JSP and the fly likes jsp and text file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp and text file" Watch "jsp and text file" New topic

jsp and text file

ibnu ros

Joined: Nov 28, 2012
Posts: 2
I have a project using jstl. how can I query data from my sql server and fetch into text file and user can download that text file.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63838

That would have nothing to do with JSTL or JSP. If you want to return a text file as a response, simply emit the text as the response and set the content-type to "text/plain".

If you want to force a download (rather than displaying in the browser), be sure to set the content-disposition such that the response is an attachment. (Do a search for exact syntax.)

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: jsp and text file
It's not a secret anymore!