• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Available Tag for rendering image using bytes array

 
mini mehta
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Does any body know of any custom tag for rendering image using a byte[]

i,e something like

<imagetag image="<%=form.getBytes() %>" height="<%form.getHeight() %>" width="<%form.getWidth() %>" />

Mini
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. And there could never be one. That's not the way HTTP works.

You would use a normal img tag and specify the src to point to the URL of a servlet that would serve up the image data.
 
mini mehta
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have already done that by creating a Image Servlet. But what i don't understand is why can't u do it through a tag. When you can have a iterator tag which accepts a Collection object, then you can always accept a byte array too.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mini mehta:
But what i don't understand is why can't u do it through a tag.


Because HTML doesn't work that way. There is no meand to put the byte data directly into an HTML page and then expect theimage to show up. You must make a spearate request through an <img> tag.

JSP isn't any kind of magic that will make HTML do anything it can't do outside of JSP.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, and please read this with regards to using words like "u". Thanks.
 
mini mehta
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:


Because HTML doesn't work that way. There is no meand to put the byte data directly into an HTML page and then expect theimage to show up. You must make a spearate request through an <img> tag.

JSP isn't any kind of magic that will make HTML do anything it can't do outside of JSP.


I never said html img will do it. I mean writing a custom jsp which has access to every object as servlet like OutputStream.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still can't do it. JSP is a templating technology used to render HTML pages to be sent to the client. You cannot do anything with JSP that HTML cannot do. And HTML cannot render images with a byte stream embedded in a page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic