ServletContext « Folder « JSP-Servlet Q&A

1. ServletContext not giving me real path when i want to go up level directory up

Why does ServletContext#getRealPath() not return me correct path if i use ../ This code works :- System.out.println(context.getRealPath("/")); This one doesn't :- System.out.println(context.getRealPath("/..")); How can i get one level up directory from getRealPath()?

2. servletContext.getRealPath() points to src folders instead of target folders

goutham.rao Joined: 09 Nov 2010 Posts: 3 Posted: Fri Nov 12, 2010 11:34 am Post subject: servletContext.getRealPath() points to src folders instead of target folders hello there, I have created a maven web application using the default archetypes in netbeans and i am running it in glassfish v3 using file --> run. when i try to get the ...