I am using the following code (in my servlet) for forwarding request to another page but whatever attributes being set before forwarding the request are getting lost. Could any body please point me out what I am doing wrong? Also whats the difference if I get Request dispatcher from HttpServletRequest rather than ServletContext ?
I feel the data is getting lost because session is getting invalidated as the session id is not being passed by the first servlet to the next servlet.
u before u farward the url attach the session id to it . u can do it by calling encodeURL method of HttpServletResponse class
getRequestDispatcher(String URL) in ServletContext - takes an absolute URL as an argument where as the method in HttpServletRequest takes an argument which can be either an absolute URL or
a relative URL
Vijay Kashyap wrote:I got it. I am using getParameter to retrieve values in JSP which is causing all the problem. But still do point out whats the differenece in getting RequestDispatcher from SevletContext / HttpServletRequest ?
then what did you use to correct the problem???