Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to display image with data in jsp page

 
sudarshan jadhav
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
How to display image and there related database value display in jsp page
I have error in tomcat is
Only show image from database but related database record value is not show on jsp page


My Jsp file is as follows
SelectCustomer.jsp


My servlet code is as follow:
GenerateBill.java



And i have genrate a bill to next jsp page

ViewBill.jsp

 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sudarshan,
Please CarefullyChooseOneForum before you post. This forum is for questions about Swing and not JSP/Servlets.

I am moving this post to the JSP forum where you can get the right responses.

Note that, we also have a forum for Servlets
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64972
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JSP is just a template for an HTML page. And in HTML <img> tags are used to display images.

What does that tell you about the approach that you are using?
 
sudarshan jadhav
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Bear for reply
I want to display image and database value on jsp page but only image is display on jsp page please give me one example which show image and value from database to jsp page
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64972
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once again, you don't show an image on a JSP; a JSP is just a template. You show the image in the HTML page that is generated from the JSP with an <img> tag. That means that the image tag had to be able to use a URL to get the image data. Passing the image data to the JSP itself is not useful. Write a servlet that sends the image data separately.
 
Rajkumar Angare
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

This is not good way to store image in DB, store image into file system, and store image url into DB, get image url from DB and

String imageURL = rs.getString("ImageURL");

I JSP <img src="<%=imageURL%>" ......

try with this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic