Netbeans puts Build in the web application "getRealPath()"
Posted on 2009-02-10
Dear Experts, I have a web app build using Netbeans 6.1, Java and Tomcat 6.0. This web app I call pbuilder for productBuilder. The web app has the following structure according the "projects" view of netbeans:
I want to store I my "secure" files under admin. I put files there like "certification.xml".
Now, in the admin directory I have a file called "viewTest.jsp: with the following scriplet:
String relativePath = request.getServletPath(); // gives value of /admin/viewTest.jsp
relativePath = path.substring(0,path.indexOf("viewTest.jsp")); // gives /admin/
String path = application.getRealPath(relativePath);
the value for path on my computer is "c:\netbeans\6.1\pbuilder\build\web\admin"
The problem is I have NOT stored my "certification.xml" file in this subdirectory so later on when I use path to try and find where I have "certification.xml" I get a missing file.
I also don't see build in the "pbuilder.war" distribution. Can someone explain why this is happending and best practice to get to my "admin" directory?
String path = application.getRealPath(path);