guys, we can forward request using request's or context's requestDispatcher.In which case we will use request, and in which case we will use context? also whats the difference between / and ../. Please help
We can forward a request either by using the RequestDispatcher() of ServletContext interface or the ServletRequest interface, the point when to use ServletContext or ServletRequest is that the ServletRequest looks for the resources in the same context (same webapp) to which the invoking servlet belongs.
Moreover the pathname used in the RequestDispatcher() of ServletContext must begin with a "/" which is an absolute path.
The pathname used in the RequestDispatcher() of ServletRequest interface can be an absolute path or a relative path means it can start with “/” or “../..”.