You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by D-Fuse <mr...@yahoo.com> on 2003/05/31 19:06:42 UTC

problem with showing an image

Hey, I load the url of an image from a properties file
in a jsp. The image doesn't show in my browser
(phoenix), when I look at the source code the image
url points to the right direction. When I save the
source code as a static html and open it in phoenix
(using file://) the image shows up. Now when I put the
same static html file in my webapp dir, and look the
at the page using http://localhost... the image
doesn't show up. (there isn't even a placeholder or
some indication that the image wasn't found)
This is the html code generated by my jsp:
<img align="left"
src="/opt/tomcat/webapps/shadowbb/images/shadowlogo.jpg"
alt="forumlogo">
Does Tomcat handle serving images differently or am I
doing something else wrong?

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: problem with showing an image

Posted by Jason Bainbridge <ja...@jblinux.org>.
On Sun, 1 Jun 2003 01:06, D-Fuse wrote:
> src="/opt/tomcat/webapps/shadowbb/images/shadowlogo.jpg"

The source of your image has to be inside the context of your web application 
(or atleast the server) for Tomcat to be able to show it, it is a security 
feature. 

Most people usually have a structure similar to the below:

TOMCAT_HOME
	/webapps
		/mywebapp
			/media
				/images
					shadowlogo.jpg
				/css
			/WEB-INF
				/classes
				/lib

In this example your image source would be src="media/images/shadowlogo.jpg".

REegards,
-- 
Jason Bainbridge
KDE Web Team - http://kde.org 
webmaster@kde.org 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: problem with showing an image

Posted by Ramesh Sabeti <rs...@reazon.com>.
Change the image location to a relative address starting from your
application location 

Src="/images/shadowlogo.jpg" or Src="images/shadowlogo.jpg"

> -----Original Message-----
> From: D-Fuse [mailto:mr_dfuse@yahoo.com]
> Sent: Saturday, May 31, 2003 10:07 AM
> To: tomcat-user@jakarta.apache.org
> Subject: problem with showing an image
> 
> Hey, I load the url of an image from a properties file
> in a jsp. The image doesn't show in my browser
> (phoenix), when I look at the source code the image
> url points to the right direction. When I save the
> source code as a static html and open it in phoenix
> (using file://) the image shows up. Now when I put the
> same static html file in my webapp dir, and look the
> at the page using http://localhost... the image
> doesn't show up. (there isn't even a placeholder or
> some indication that the image wasn't found)
> This is the html code generated by my jsp:
> <img align="left"
> src="/opt/tomcat/webapps/shadowbb/images/shadowlogo.jpg"
> alt="forumlogo">
> Does Tomcat handle serving images differently or am I
> doing something else wrong?
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org