Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to access images that are not in war file???

 
Rajan Punchouty
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have upload directory for images on my hard disk. I want to access them in HTML image tag. how to access them with respect to application context. As example C:/upload has images and i put my war file in C:/tomcat/webapps.
Thanx in advance,
Rajan
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are two possibilities:
1. Put the image files where the web server is allowed to serve from - which would be under tomcat/webapps/somecontext and use a src in the image tag that points to that directory. Note that the web server will not normally be allowed to serve files from C:/upload
2. Serve the images via a servlet - in which case the src will have to point to the servlet and include the image file nam.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic