Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Outputting binary data in a JSP  RSS feed

 
Osama Hasan
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys!
I wanted to know how to output binary data such as a gif image through a JSP.
Thanks in advance!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically, you can't because JSP are designed to manipulate and send text as character streams. To create and send binary data such as images, PDF files or sound files, you just have to use servlets. All you have to do is make your JSP write IMG tags having a SRC that addresses a servlet.
Some folks seem to be scared of using servlets but there really is no reason to resist. Any good servlet/JSP book will have examples.
Bill
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!