This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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!