This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes gif encoding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "gif encoding" Watch "gif encoding" New topic

gif encoding

prabhat gupta

Joined: Aug 21, 2001
Posts: 26
I want to generate a number of rectangular boxes with text in each box just like flowcharts.I havent tried anuthing on this but just have the concept in mind.I want to generate it on the fly using jsp pages.For this i need to draw the image on to a virtual awt.Panel object.I am using the GifEncoder API provided by acme which encodes the drawn objects to a gif image and sends to the client.this concept is mentioned by Jason Hunter in his book "Java Servlet programming".
My problem here is that since i want to use the same API from jsp pages and the Api needs to call a method and send the output stream object to it to print the image to the jsp has a out object which is a PrintWriter how can i pass the ServletOutputStream object to it.
The method is :
ServletOutputStream out = res.getOutputStream();
GifEncoder encoder = new GifEncoder(image,out);
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
No - don't try to generate binary data from a JSP page. JSP pages just naturally want to output character encoded data. Write a servlet just like in Hunter's book.
Don't get me started about those stupid light bulbs.
subject: gif encoding
Similar Threads
Urgent-servlet response
how image path should be passed to servlet
MultipartResponse(Sending Image and HTml Content )Servlets
jsp session traking
Writing Image Bytes on Response Stream