Hellow everybody, i was looking and found just two places where url/path is relative to webapps directory(not to root of application and to the uri), they are: 1) HttpServletResponse.sendRedirect where if you start with a / it will refer to the root of webapps 2) ServletContext.getResource(ou getResourceasStream) where / is mandatory and refer to the root of webapps. Does anyone knows another place where / refer to webapps root, it may be in web.xml, directives, anywhere...thanks!!!
from SCWCD Exam Study Kit, pg 57 There is an important difference between the getRequestDispatcher() method of ServletContext and that of ServletRequest: you can pass a relative path to the getRequestDispatcher() method of ServletRequest but not to the getRequestDispatcher() method of ServletContext. For example, request.getRequestDispatcher("../html/copyright.html") is valid, and the getRequestDispatcher() method of ServletRequest will evalute the path relative to the path of the request. For the getRequestDispatcher() method of ServletContext, the path parameter cannnot be relative and must start with /. This makes sense because ServletRequest has a current request path to evaluate the relative path while ServletContext does not.
[ July 17, 2002: Message edited by: Jessica Sant ]