• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Confused about Server Paths

 
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a bit confused as to how to define the relative server paths to various files for a site within a JSP Page.
What I want to do is to set up path so I can create an HTML table of images. The main image would be in the "pics" directory and the thumbnail image would be in the "thumbnail" directory.
Basically, the table would show thumbnails and when the user clicks on one, he would see the full-size image in the pics directory.
The Tomcat server set up currently looks like this:
---- Scuba //localhost/scuba.jsp
------pics // main pictures directory
------thumbnails // thumbnails directory
I tried using the getServletContext.getRealPath() as shown below. THis works fine on the same machine you're on, but not from elsewhere:
// Define paths
String pathToPics = getServletContext().getRealPath("/scuba/pics");
String pathToThumbnails = getServletContext().getRealPath("/scuba/thumbnails");
==========================================
So, how do I create a relative path from a JSP page to another part of the server path?
Do I just use "/scuba/pics" and "/scuba/thumbnails" ???
I tried this and it didn't seem to work with my existing code.
I appreciate anyone's help in advance.
-- Mike
 
Mike London
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please close this topic.
My problem above, now solved, turned out to be a Tomcat Configuration issue.
-- Mike
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic