Meaningless Drivel is fun!*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "images in Tomcat" Watch "images in Tomcat" New topic
Author

images in Tomcat

Gayathri Neti
Greenhorn

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 path..like:
file:///E:\folder1\images\sample_logo.gif

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
Greenhorn

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

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

Joined: Jan 10, 2002
Posts: 60785
    
  65

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Gayathri Neti
Greenhorn

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..)
thanks,
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: images in Tomcat
 
Similar Threads
need help on Sun Java App Server 9.1
image not getting to display
Problem showing image files
Regarding URI
Giving each webapp its own context root