Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
76
rated 0 times [  80] [ 4]  / answers: 1 / hits: 30715  / 12 Years ago, thu, april 5, 2012, 12:00:00

I am trying to use an image in the below index.jsp file in a dynamic web project that I created in Eclipse Indigo IDE. I have added the image under WEB-INF/images/pict1.jpg under WebContent of my project folder. But when I am running in browser, the image is not visible. The text and submit buttons are coming as expected. Am I missing anything? Any idea about how to make the image appear?



Any help will be appreciated.
Below is the code.



Thanks,



Somnath



<%@ page language=java contentType=text/html; charset=ISO-8859-1
pageEncoding=ISO-8859-1%>
<%@ taglib uri=/WEB-INF/tld/c.tld prefix=c %>




<html> 
<head>
<meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1>

<c:import url=/WEB-INF/javascript/index.js />

<title>My Page</title>
</head>
<body>
<img alt=picture1 src=images/pict1.jpg>
<table border=0>
<tr><td valign=top>
<h1>Continue</h1></td><td><input type=submit></td></tr>
<tr><td valign=top>
<h1>Continue</h1></td><td><input type=submit></td></tr>
</table>

</body>
</html>

More From » eclipse

 Answers
6

The image 'src' attribute is relative to the context root of your web application. Images don't go in WEB-INF. Move the 'images' folder to the WebContent folder of your project.



WEB-INF is usually reserved for metadata about your project that the container uses. Your application jsps and other resources are usually in folders relative to the WebContent folder.


[#86411] Tuesday, April 3, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
charisma

Total Points: 1
Total Questions: 99
Total Answers: 117

Location: Thailand
Member since Thu, Apr 22, 2021
3 Years ago
;