0

I am using code < img src="C:/NetBeanProject/images.jpg" alt="abc" width="42" height="42"/> to display an image to my jsp page. However, the image is not shown in the page. Is there any wrong with that code ?

5
  • Verify the name of image file and name and path at <img/> tag. Commented Jan 3, 2012 at 5:48
  • which code..?post atleast that code portion that you are trying to display image. Commented Jan 3, 2012 at 5:48
  • I have verified many times the path and file name. Commented Jan 3, 2012 at 5:51
  • @Tijo, the bold letter code is which I use to display image. Commented Jan 3, 2012 at 5:53
  • Create a folder under root (say images) of web-app, copy that file in it and use relative path. Commented Jan 3, 2012 at 6:08

2 Answers 2

1

In web-app, images and public resources must be located at folder under the root. You should have to create folder "images" under "web" (netbeans project) and move images.jpg in images folder.

web/
   |___/images
   |      images.jpg
   |
   | index.jsp

In index.jsp,

<img src="images/images.jpg" alt="logo"/>
Sign up to request clarification or add additional context in comments.

Comments

1

avoid the space inside img tag before img like <img src="C:/NetBeanProject/images.jpg" alt="abc" width="42" height="42"/>.

It will work.

There was some space is space is showing in your code inside img tag.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.