Thanks ORG. The ServletContext method solved my problem.
Rajendra On 3/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hi Rajendra, This also confused the hell out of me. Here are some tips If a url is relative, its relative to the page eg moreInfo/Details/SomePage.htm So its going to depend on the page the user is viewing and go from there... just like normal HTML pages. When you want it to go to an "absolute" relative page LOOK at the folders under you project name, or the folders under Web Pages in netbeans ONLY. So in Netbeans if you have Details/SomePage.jsp under Web Pages and you want the link to go there, you would write it as /Details/SomePage.jsp That little / at the beginning makes it go to that page regardless of the page it is in. Now when you want to get at your class files, you normally just use the class name, no paths. eg: <jsp:useBean scope="request" id="searchBean" class="com.myco.searchResultBean" /> BUT if you want to get at say the actual bytes then one way is to ServletContext context = getServletContext(); sWebInfPath = context.getRealPath("/WEB-INF/"); This will give you that actual location on your file system and then you can just use (new File) etc to get at the physical file in the sub folder. A more advanced function is to go the same way as you would if you wanted to extract the bytes of a class from a Jar file in = getClass().getResourceAsStream(sPackageName); it also works on Tomcat. Hope that helps..... Heres some free software for you http://coolese.100free.com/ All done on the amazing Tomcat ----- Original Message ----- Hi, I am using TOMCAT 5.5. I am creating a file in class that is called from a JSP. However, the relative path that I have specified in the class doesn't seem to work. The path that I have used is :"/webapps/Jonathon/WEB-INF/etc/subscriber.txt". Can someone please let me know, what is wrong with the relative path ? thanks in advance, Rajendra --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]