File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes IMG not displayed when inside server (tomcat) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "IMG not displayed when inside server (tomcat)" Watch "IMG not displayed when inside server (tomcat)" New topic
Author

IMG not displayed when inside server (tomcat)

Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
Hi,

I have a very simple page, sample.html, with nothing inside but 1 img tag



If I open this sample.html by double-clicking it in windows explorer, it opens as expected.

If it is served from the server, the image is not displayed.

Any thoughts?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41049
    
  43
Why would a page served from a server include an image tag that references an image that's on the client? This page would only work on your machine, not anywhere else.


Ping & DNS - my free Android networking tools app
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
Originally posted by Ulf Dittmer:
Why would a page served from a server include an image tag that references an image that's on the client? This page would only work on your machine, not anywhere else.


Sorry I just realized that; i asked the wrong question.

Actually, my problem is:

I have an empty table TD tag, with id, like below:



Now, I use javascript .innerHtml to put an IMG tag inside it, as below:



The image is not displayed.

(I checked by checking the value of the imageHolder and I get the correct data "<img src='C:/image/A.jpg'>", but there is no image displayed.)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41049
    
  43
I've never tried that (as I said, I don't think it makes much sense), but it could be a security restriction that pages from a server are not allowed to reference local files.
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
The page is already served at the client when I triggered the change for IMG tag.

The image exists in the client PC.

I also am looking at the possibility that it is related to security.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Most modern day browsers do not let you link to local files.

Eric
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
Originally posted by Eric Pascarello:
Most modern day browsers do not let you link to local files.

Eric


If say I will allow even there is security hole on the resolution, is there any such way, so that I can do so and have my image displayed?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IMG not displayed when inside server (tomcat)
 
Similar Threads
Adding an image to a frame
how to get header information from a file ??
Image is not getting displayed in web application html page
how to retreive an image from server location
problem with drawImage()