Meaningless Drivel is fun!
The moose likes JSP and the fly likes Display image which is store in database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Display image which is store in database" Watch "Display image which is store in database" New topic

Display image which is store in database

chain singh
Ranch Hand

Joined: Feb 28, 2012
Posts: 117

I am using sqlserver database where i have one table called image_master and just one column called user_image of image type.

I see some examples on that forum like

but i dont want to use src="images/Beanie/<%=rs.getString("Image") %>" this complete path i just want to use file from database.

like <%=rs.getString("user_image")%> and this insert image in code.

please help me

thanks in advance

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63874

JSP is a template technology that creates an HTML page to send to the browser. So the browser gets an HTML page that you could have written by hand. When you create an HTML file do you type the image data into it? Of course not. So your JSP can't do that either.

How do you reference an image in an HTML file? With a URL. So your JSP needs to do the same. Use a URL that references a servlet that serves the image data.

P.S. This question has been asked dozens of times in this forum. Please SearchFirst.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Display image which is store in database
It's not a secret anymore!