showing images in web application

Juuno's Avatar, Join Date: Feb 2009
Go4Expert Member
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's Avatar, Join Date: Jul 2004
Go4Expert Founder
See the final HTML and see what is the output for

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