• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to show Blob image from database using jstl

 
Greenhorn
Posts: 11
Netbeans IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
I got this tutorial link and it work fine but when i try to select the picture using JSTL tags it shows picture with broken links cause it's Blob
here is the code to show the picture



my question is can it be using jstl and is there any tuts
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need a separate server request for the image. For example, you could have a servlet that takes an image id and returns the binary image. That way your "main" JSTL just needs to output the URL for that servlet request.
 
isslam akkilah
Greenhorn
Posts: 11
Netbeans IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
do you have any link that you think it's good and correct way
 
Marshal
Posts: 28176
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes indeed, we have a page right here on the Ranch all about that. "Image Servlet" is the usual name of the thing you want to produce and our page about that is here: https://coderanch.com/wiki/660125/Image-Servlet

You'll see there's a lot of details you have to deal with but it's all pretty straightforward once you work through it. Let us know if you have problems, that's what we're here for.
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:You need a separate server request for the image. For example, you could have a servlet that takes an image id and returns the binary image. That way your "main" JSTL just needs to output the URL for that servlet request.


Most modern browsers support inline data as well. The source would be data:<mime type>;base64,<base64 data>. For example (truncated), data:image/png;base64,iVBORw0KGgoA.....
 
Sheriff
Posts: 67746
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
Bearing in mind that that's not generally recommended (no caching, etc...)
 
isslam akkilah
Greenhorn
Posts: 11
Netbeans IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i solve it using img tag and the context path thing inside the src??
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Bearing in mind that that's not generally recommended (no caching, etc...)


Unless if the image occurs only on the page itself, and the page itself is already cached.
 
Bear Bibeault
Sheriff
Posts: 67746
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

Rob Spoor wrote:

Bear Bibeault wrote:Bearing in mind that that's not generally recommended (no caching, etc...)


Unless if the image occurs only on the page itself, and the page itself is already cached.



Unlikely in a Java web app where caching is usually disabled.
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've seen enough html files being properly cached, and you can add your own caching as well. I had to add some of that manually a few times already.
 
Bear Bibeault
Sheriff
Posts: 67746
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
My point applies to content that's not pure HTML such as JSPs (or other template-generated views), which comprise the majority of views in a Java web app.
 
reply
    Bookmark Topic Watch Topic
  • New Topic