When you get a request dispatcher from servlet context, you have to start the path with a "/" because here there is no concept of any relative path. The container will look for the resource with respect to the application root.
When you get a request dispatcher from request then, you can give the resource path with or without "/" because here there is concept of relative path (relative to the request coming from the client). If the resource path starts with a "/" then the container will look from the app root. If the resource path is without "/" the container will look with respect to the request path.
Joined: Mar 05, 2008
Thanks for your replies, but i am not quite convinced with your answers, as i found similar replies when i google. Requesting for appropriate reply, which is not covered in book or in APIs.
Fist I will put on what i understood.
There is absolutely no difference between above two, apart from objects which the getRequestDispatcher() method is called.
From my example relative/logical paths are no were given importance, they are treated as same.
am i correct ? please clarify.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com