This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Confused about Server Paths  RSS feed

 
Mike London
Ranch Hand
Posts: 1476
10
  • 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: 1476
10
  • 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!