my dog learned polymorphism*
The moose likes JSP and the fly likes how to display image with data in jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to display image with data in jsp page" Watch "how to display image with data in jsp page" New topic
Author

how to display image with data in jsp page

sudarshan jadhav
Ranch Hand

Joined: May 28, 2012
Posts: 42
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

Joined: Oct 16, 2003
Posts: 1076
    
  10

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

Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60789
    
  65

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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sudarshan jadhav
Ranch Hand

Joined: May 28, 2012
Posts: 42
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

Joined: Jan 10, 2002
Posts: 60789
    
  65

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

Joined: Dec 23, 2012
Posts: 3
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.
 
Consider Paul's rocket mass heater.
 
subject: how to display image with data in jsp page
 
Similar Threads
Unable to find specific product
Paging in jsp
Client side validation not working
How to create displaytag table border
fixed header, problem with alignment, must support all browsers