Hi there! Please spare some of your precious time to help me with this. I think it might be a basic Java problem but maybe a JSP/servlet problem too. Here is what I'm trying to do: I have a jsp which runs off the Tomcat root context in my home machine as follows E:\Tomcat33\webapps\ROOT\mysite\myjsp.jsp I then want to know the current directory where this jsp is running. I use application.getRealPath(request.getServletPath()) and I get it as: E:\Tomcat33\webapps\ROOT\mysite\myjsp.jsp I then want to load a properties file using the above location which means that I want the path : E:\Tomcat33\webapps\ROOT\mysite\myprop.properties I'm using this technique to avoid hardcoding. How could I then manipulate: E:\Tomcat33\webapps\ROOT\mysite\myjsp.jsp into E:\Tomcat33\webapps\ROOT\mysite\myprop.properties? I have looked at the String class but none of the methods there seem to help me. Your help would be greatly appreciated.
In a time of drastic change it is the learners who inherit the future. The learned usually find themselves equipped to live in a world that no longer exists.<br />Eric Hoffer
How could I then manipulate: E:\Tomcat33\webapps\ROOT\mysite\myjsp.jsp into E:\Tomcat33\webapps\ROOT\mysite\myprop.properties 1. Use the String method int p = lastIndexOf( '\\' ) to find the last separator. 2. Add the file name String pth = jspPath.substring(0,p ) + "\\myprop.properties" ; That really should be File.separatorChar instead of '\\' Bill