Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to load images using 'img' tag

 
Seetamraj Sriharsha
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Update: Issue is with Eclipse workspace

Hi,

Following is the only code I have in <body> section of JSP page



I have created "images" folder inside "WebContent" (the same folder in which WEB-INF resides). I have copied the image, 'light.jpg' into both 'WebContent' and 'images'

Now when I run the .jsp, all I see is the alternative text (image #1 and image #2)that I entered in <img> tags.

When tried to access the image with following url, I get HTTP 404 with description, "The requested resource is not available"

(configured tomcat to run HTTP/1.1 at port 80)
localhost/HelloWorldJSP/images/light.jpg
localhost/HelloWorldJSP/light.jpg

Let me know, if it is code or the environment I have to worry about.

Attachment: screenshot of the WebContent folder from my Eclipse workspace
dir.jpg
[Thumbnail for dir.jpg]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to your screenshot your images are no in the images folder.
 
Seetamraj Sriharsha
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:According to your screenshot your images are no in the images folder.


Image is in both locations. I was just trying out paths. Nothing works!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove the extraneous images. They just confuse the issue.

Does a simple JSP placed in the context root work? If not, then your app is not deployed properly. If so, then it might be another issue.

Also, are you running Tomcat (or whatever) standalone, or within the IDE?
 
Seetamraj Sriharsha
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Remove the extraneous images. They just confuse the issue.

Does a simple JSP placed in the context root work? If not, then your app is not deployed properly. If so, then it might be another issue.

Also, are you running Tomcat (or whatever) standalone, or within the IDE?


(1) I just created 'index.jsp' in same context root and it runs. But it has issues linking external CSS file
(2) I configured Tomcat 7 with Eclispe IDE. I'm running JSP's in both IDE and browsers

index.jsp

myStyle.css

So, it has to be environment.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest running the container standalone. But since you are running it from an IDE, I've moved this topic to the IDEs forum.
 
Seetamraj Sriharsha
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:I would suggest running the container standalone. But since you are running it from an IDE, I've moved this topic to the IDEs forum.


Running JSP in standalone container worked. Both linking CSS and showing images using tag worked.
Issue should be with Eclipse workspace.

All,
Can someone please help me out with the workspace.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic