Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Available Tag for rendering image using bytes array

 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Won't you be my neighbor? - Fred Rogers. tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic