File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Setting response header through Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Setting response header through Javascript" Watch "Setting response header through Javascript" New topic

Setting response header through Javascript

Ramesh Bhagasra

Joined: Nov 21, 2003
Posts: 8
Hi guys
I have to show a file to the client using the browser, I have the file contents stored in my Blob Field in the Database. Now I want to display the file on clilck of a button called DOWNLOAD and then determine the type of file, correspondingly setting the contentType and setHeader of response object. How can i do that??? Please help me at ur earliest...
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13025
Your "Download" button will have to create a request to a servlet - not a JSP - because JSP are designed only to serve characters. This kind of question comes up all the time - browsing around in the servlet and JSP forums or doing a search will get you lots of hits. Or you could even buy a book.
wood burning stoves
subject: Setting response header through Javascript
It's not a secret anymore!