Resolving image source tags in a Web browser

Resolving image source tags in a Web browser

I'm doing a project using JSP in Jbuilder6, and I want to know how to embed a picture to my JSP file? I use this tag:
<img

    Requires Free Membership to View

    When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSAP.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSAP.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

src="E:/WINDOWS/jbproject/MailServer/defaultroot/hashiye.bmp" align="right">

When I use this tag in a simple HTML file the picture appears, but when I run the project in jbuilder I can't see the picture in the JSP file. Would you please tell me what's the correct "src" parameter for this tag in JSP?

The file Url is:
vfs://host:0/file:///E:/WINDOWS/jbproject/MailServer/defaultroot/HomePage.jsp
And when I run the project, the url is:
http://localhost:8080/HomePage.jsp


The tag: <img src="E:/WINDOWS/jbproject/MailServer/defaultroot/hashiye.bmp" align="right"> tells the Web browser to look for the image in a local directory rather than on a Web server. If a user requests this page over the network, the Web browser will try to find this image on the user's personal computer, instead of pulling it off the Web server. Of course, the image does not exist on the user's computer, so nothing will be displayed.

When you view the simple HTML in a Web browser on your local machine, the browser is able to use the directory path specified to retrieve the image. However, JBuilder acts as a Web server when dealing with JSPs. It will not be able to find this image, as the path specified is not a network-available URL. Try the following as your image tag:

<img src="http://localhost:8080/hashiye.bmp" align="right">

Bear in mind that a 'localhost' reference also refers strictly to your local machine. Another computer attempting to access 'localhost' across the network will end up referring to their local machine rather than your Web server. You should either use relative links or specify the unique IP address of your computer in the JSP.

This was first published in September 2002