Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

method to ouput an image from JSP  RSS feed

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to output an image from a jsp using the outputstream object.

(if there is a better way plz let me know)

this image i am trying to read into an inputstream an store it an bytearrayoutputstream , then sending it .
plz tell me how to do it.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you don't need to...
Use a servlet instead to output the binary data. Far cleaner and easier solution.

And never try to mix different mimetypes in a single response, it just won't work (so don't think you can write a single JSP that returns both the text of your page and the image data).
 
Joel Karimpil
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeroen,

thanks.
but can u tell me how to or refer me to some sample code.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's some code I use in one application to render a progress bar:

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!