Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Everyone,

I'm just a newbie with struts and I want to display an image onto JSP pages, but I can't make it display the image.

I tried to put the folder contain the images in "Web Content" folder but it didn't work and I tried to put it in "WEB-INF" folder, but it still didn't work.

Could anyone help me please?

This is the image tag i put in JSP page.
HTML
<img alt="logo" src="/resources/images/header.jpg"/>


Thanks for any comment
CK
Posted
Updated 16-Jun-16 21:06pm
v3
Comments
Member 12053927 20-Feb-16 0:05am    
hi if image is stored in database than how we can load on page in jsp.
ex. we have table name bb and image type is blob.

 
Share this answer
 
Comments
nguyenle.it 13-Dec-11 9:33am    
Thanks for your comment, but i mean i can't display image on jsp page, could you help me please?
Nagy Vilmos 13-Dec-11 10:53am    
Read the links you've been given. Now, what don't you understand?
RaviRanjanKr 13-Dec-11 16:12pm    
Nice link, My 5!
Thank you so much for any comment
I solved it by myself
This is the solution
In the jsp file of struts i have to have this directive to use html tag lib and in the "img" tag i should use rewrite attribute to link to the image file. And the image you should put in the Web Content path

And this is the jsp file in struts

HTML
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>

<img alt="logo" src="<html:rewrite page='/resources/images/header.jpg'/>" width="100%" height="20%"/>
 
Share this answer
 
v3
Comments
NikulDarji 14-Dec-11 0:35am    
nice....:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900