Forums Register Login
displaying images in jsp page..
iam working on my search page..when a users name is typed..his details and his snap in jpg format is shown on the next jsp page.
which is the better way to show the image in jsp, by storing the url of the image in the table or making a column with image type. iam using sql 2000 as my database.
please guide me as to how to store and retrieve the image in the jsp page..
I think the first choice is the better one and i'd like to it that way only. So go ahead....
hi..tkx for the reply..and iam storing urls only..
but can u elaborate further..as to how can we display then on the jsp page..

made the following changes:
stored the url of the image in the database..
and in the jsp page..defined a path variable.
string path=rs.getString("http://localhost:8080/mech_iit/images");
and a select query to retrieve the image..from the table..
and in img tag:
<img height=150 src=<%=path%>>
bt thats not solving the problem..
doesnt show in any image
[ April 07, 2004: Message edited by: jyotsana dang ]
I am not sure you are using the method
rs.getString("http://localhost:8080/mech_iit/images"); to retrieve the image URL. U shud be using the column name in the method. Well if it is a printing mistake, ignore it.
Instead of putting the absolute URl , u give the relative path according to your webapplication.
URL = "../images/abc.gif"

[ April 09, 2004: Message edited by: Shankar Narayana ]
jyotsana dang:
Just follow Vicky's advice by having the images in a directory and the link to the image on your sql database with a column header say imageColumn, then call the column name i.e. rs.getString(imageColumn) on the image tag of your JSP file and you should be alright.
well, i did the following changes in my page.
String path="";
rs=stmt.executeQuery("select image from table");

image is the string type column name where the path to the image is stored. images are of jpg type stored in the server.
but iam still not able to display the images in my jsp page.
Any better way of doing this?
Can anyone provide me with a code for this stuff?
[ April 21, 2004: Message edited by: jyotsana dang ]
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
Rocket Oven Kickstarter - from the trailboss

This thread has been viewed 2450 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 19, 2018 09:46:17.