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.
The moose likes JSP and the fly likes How can I output a binary stream from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "How can I output a binary stream from JSP" Watch "How can I output a binary stream from JSP" New topic
Author

How can I output a binary stream from JSP

C Vivek
Ranch Hand

Joined: Oct 03, 2004
Posts: 115
Hello,

How can I output a binary stream using JSP?
I would like to create various links of downloadable PDF's!

Thanks
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

JSP is a very poor choice of technology for streaming binary data.
It's a templating language meant for building up textual output.
Most JSP compilers (Jasper included) will add their own characters to the output fouling up an binary data.

I've seen people get it to work but they usually have to jump through some hoops that result in difficult to read JSPs.

This is much easier done from a servlet.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
C Vivek
Ranch Hand

Joined: Oct 03, 2004
Posts: 115
Thanks Ben!
If I would like to create a set of links in my JSP for downloading a set of files say in PDF format. How do I communicate with the Servlet and activate the download? I would like to keep the JSP page active so other links can also be clicked simultaneously.

I dont want to redirect to a resource.
Many Thanks
Vivek
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I output a binary stream from JSP
 
Similar Threads
Difference in opening binary stream in jsp & servlet
jsp with POI FILE System concept.
How to store image, audio, video & text files POSTed to JSP page?
IllegalStateException from jspwriter
Diff in opening binary stream in JSP & Servlet