Hello friends,
I want to display an image in my JSP using expressions (<%=abc%>)tag. But, the problem is that the JSP does not show the image.
I store the path retrieved from database (MS SQL) in a "path" variable and then try to display it in JSP using <img> tag.

The code is as follws:
<img src="<%=path%>" mce_src="<%=path%>" width="260" height="261" border="2" >
where, path="temp/" + image; //temp is the folder containing image
//image=image name corresponding to user logged in,since,image is stored with name same as user name.

Is there anything else that should be included in the code?
Is the src path right?
In my other JSPs where i directly give image names, images are displayed. Then why not here? I think the problem is in src="<%=path%>" , but can't figure it out.

Please help.
THANK YOU.

Recommended Answers

All 2 Replies

Let me clear it out.
I accept an image from users and store them in byte format in database at the same time i convert the bytes to image and store it in "temp" folder with name - "username+image type".
While retrieving, i specify the image name in "path" variable so as to retrieve it directly from folder and not database.
Yet, the image is not displayed.Please help.

what's actually generated as code and sent to the browser?
Almost certainly the paths shown there are utterly incorrect and have no relation whatsoever to the paths of the images relative to the deployroot of the web application.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.