I am trying to display an image on jsp . My image file is located at
MyApp/WebContent/images/logo.jpg
And my JSP pages are located at
MyApp/WebContent/WEB-INF/view/home.jsp
I already tried to use the image
<'img src="<%=request.getContextPath()%>/images/logo.jpg" />
and
<'img src="<'c:url value='<%=request.getContextPath()%>/images/logo.jpg'></c:url></img>
Is this problem due to my hierarchy of locations where I posted my image?
I really appreciate your help. Thanks.
UPDATE :
I found a solution to my problem at: http://www.tutorialspoint.com/spring/spring_static_pages_example.htm
I just need to use resource mapping in my servlet.xml .
I really appreciate all your kind answers. :)
java url spring-mvc jsp image
Phuu792
source share