Click here to Skip to main content
13,201,934 members (73,984 online)
Rate this:
Please Sign up or sign in to 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.
<img alt="logo" src="/resources/images/header.jpg"/>

Thanks for any comment
Posted 12-Dec-11 22:20pm
Updated 16-Jun-16 21:06pm
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Comments 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!
Rate this: bad
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="" prefix="html" %>
<img alt="logo" src="<html:rewrite page='/resources/images/header.jpg'/>" width="100%" height="20%"/>
NikulDarji 14-Dec-11 0:35am

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171020.1 | Last Updated 17 Jun 2016
Copyright © CodeProject, 1999-2017
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