Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   showing images in web application (http://www.go4expert.com/forums/images-web-application-t17456/)

Juuno 10May2009 20:28

showing images in web application
I have my web application in Java and I put my images in myapplication/WebContent/img.
And I would like to load that image from my html and I called it with:

HTML Code:

<img src="${pageContext.request.contextPath}/img/myimage.jpg" width="200" height="100" alt="can't display image"/>
and when I run my program, it only displays "can't display image"(alt) and no image. and when I right-click on that "can't display image" and copy image location, then it shows "http://localhost:8081/myapplication/myimage.jpg"

as far as i check, the location and the file name is right. What's wrong with it?
Thanks in advance.

shabbir 10May2009 21:01

Re: showing images in web application
See the final HTML and see what is the output for

<img src="${pageContext.request.contextPath}/img/myimage.jpg"

All times are GMT +5.5. The time now is 00:16.