File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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: 63548

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:
subject: jsp and text file
jQuery in Action, 3rd edition