This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hi i am trying to download binary file by a jsp file but it is showing the content (not all) on the browser. I want to save that file automatically to the client machine in a specified location. Please help.
S K B<br />SCJP 1.5 (83%)
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35237
7
posted
0
JSPs aren't meant for streaming binary content (and for all practical purposes, they can't). Use a servlet instead.
then how to do it by servlet. please let me know... Give one sample code.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35237
7
posted
0
An example can be found under "Simple Stream" in the Code Barn.
Kishore Dandu
Ranch Hand
Joined: Jul 10, 2001
Posts: 1934
posted
0
Originally posted by Ulf Dittmer: An example can be found under "Simple Stream" in the Code Barn.
How do we render the images, if i try to invoke the servlet directly it gives:"The following image files are located under the WEB-INF directory and, thus, can not be seen with a browser unless streamed through the StreamServlet: "
The example shows how to stream a resource through a servlet. This is useful for not only controlling access to resources hidden under WEB-INF from direct access, but for controlling the response headers so that the download acts in ways that you want.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.