Click here to Skip to main content
11,414,561 members (69,482 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java JSP struts
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.
<img alt="logo" src="/resources/images/header.jpg"/>

Thanks for any comment
CK
Posted 12-Dec-11 23:20pm
Edited 13-Dec-11 1:20am
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
nguyenle.it at 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 at 13-Dec-11 10:53am
   
Read the links you've been given. Now, what don't you understand?
RaviRanjankr at 13-Dec-11 16:12pm
   
Nice link, My 5!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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

<%@ 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%"/>
  Permalink  
v3
Comments
NikulDarji at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 9,130
1 OriginalGriff 7,477
2 Maciej Los 3,710
3 Abhinav S 3,298
4 Peter Leow 3,084


Advertise | Privacy | Mobile
Web03 | 2.8.150427.4 | Last Updated 13 Dec 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100