Win a copy of Microservices in Action this week in the Web Services forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

accessing files on the server  RSS feed

Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I m creating a jsp which calls a bean to search a file on the server.Next the bean returns a Vector of strings as absolute paths to the file on the server.The same path is passed to href tag to give links to the file name in generated html page.But since the path string gives path from the root drive on the server ,Clicking on the link gives an error saying file not found .It is obvious that the absolute path that bean returns is on the server and not on clients machine.
Should i give relative URL wrt the web directory.
Suppose on the server ,The bean returns a path like:
and that my jsp files on jakarta Tomcat server are in "
can i extract the substring as "webapps/prabhat/prabhat.doc" and give the following href tag in the generated Html file.
"<A Href='../webapps/prabhat/prabhat.doc'></a\A>"
Will this tag work.
I want to open MS word files in IE browser by the above method.
If files are not in the Web servers Directory but rather in some other directory on the server say
"d:\temp\prabhat.doc" then how to give the right path in html to open that file.
Please help.
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the file exists under a webapp, you give the url without the directory webapp
/prabhat/prabhat.doc This will allow the request to use the other prabhat webapp to serve the file.
Most servers will not serve up a file that is not under a defined webapp. Thank God! (Or the author of the webserver) This would be a huge hole that would open your server to all kinds of hacking!
If you need to allow access to the file, put it under a webapp.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!