• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

images in Tomcat

 
Gayathri Neti
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gayathri Neti
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please show me as an example??
Thanks.
 
Andy Deighton
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is certainly not Tomcat specific. Should it not be moved to the HTML forum?
bear
 
Gayathri Neti
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic