Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Confused about Server Paths  RSS feed

 
Mike London
Ranch Hand
Posts: 1340
8
  • Mark post as helpful
  • send pies
  • 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
Ranch Hand
Posts: 1340
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please close this topic.
My problem above, now solved, turned out to be a Tomcat Configuration issue.
-- Mike
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!