File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes images in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "images in Tomcat" Watch "images in Tomcat" New topic

images in Tomcat

Gayathri Neti

Joined: Mar 08, 2002
Posts: 25
I have web application on TomCat 4.1.18. I am using a couple of images in my application.
I am setting the 'img' tags' src property as an absolute

I want to use a relative path. How is it possible?
Please indicate if I need to make any configuration changes? OR
Is it only a change in the SRC attribute of IMG tag
Andy Bowes
Ranch Hand

Joined: Jan 14, 2003
Posts: 171
You can use a relative URL to define the source of the image. This is typically relative to the directory that your page/JSP is in.
In a typical web-application the images should be held in a sub-directory of your application directory in the web-apps directory. In a production environment you would store all of the pages, classes, images etc in a WAR file with the equivalent internal structure.

Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams
Gayathri Neti

Joined: Mar 08, 2002
Posts: 25
Could you please show me as an example??
Andy Deighton
Ranch Hand

Joined: Apr 01, 2003
Posts: 39
Your src attribute of your img tag would simply be something like "images/". This assumes you have an images subdirectory in your webapp directory or webapp jar.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

This is certainly not Tomcat specific. Should it not be moved to the HTML forum?

[Asking smart questions] [About Bear] [Books by Bear]
Gayathri Neti

Joined: Mar 08, 2002
Posts: 25
Well, (I am a newbie) The only reason I put my question here was..
I am using Tomcat AppServer. I did not know if I needed to make any configuration changes too...
(even now, I am not sure if I have to make configuration changes. I guess I need not..)
I agree. Here's the link:
subject: images in Tomcat
It's not a secret anymore!