aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Unable to load images using 'img' tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Unable to load images using Watch "Unable to load images using New topic
Author

Unable to load images using 'img' tag

Seetamraj Sriharsha
Greenhorn

Joined: Nov 09, 2009
Posts: 20
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


[Thumbnail for dir.jpg]

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

According to your screenshot your images are no in the images folder.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Seetamraj Sriharsha
Greenhorn

Joined: Nov 09, 2009
Posts: 20
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

Joined: Jan 10, 2002
Posts: 61766
    
  67

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

Joined: Nov 09, 2009
Posts: 20
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

Joined: Jan 10, 2002
Posts: 61766
    
  67

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

Joined: Nov 09, 2009
Posts: 20
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to load images using 'img' tag