This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Modern JavaScript for the Impatient and have Cay Horstmann on-line!
See this thread for details.
Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how to show Blob image from database using jstl

 
Greenhorn
Posts: 11
Netbeans IDE PHP Java
  • Mark post as helpful
  • send pies
  • 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: 40169
812
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
do you have any link that you think it's good and correct way
 
Marshal
Posts: 25795
69
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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: 21997
107
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • 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.....
 
Marshal
Posts: 67445
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
i solve it using img tag and the context path thing inside the src??
 
Rob Spoor
Sheriff
Posts: 21997
107
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • 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
Marshal
Posts: 67445
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • 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: 21997
107
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • 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
Marshal
Posts: 67445
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • 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.
    Bookmark Topic Watch Topic
  • New Topic