Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display image which is store in database

 
chain singh
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello


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
Marshal
Pie
Posts: 65114
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic