I am trying to forward a request using "RequestDispatcher". I have JSP pageContext object. I tried to forward my request to my servlet "MyServlet" using the following code. I set some attributes in my request and forwarded it. But i am not able to access those variables in my servlet class.
My code :
pageContext.getRequest().setAttribute("AValue","A");
pageContext.getRequest().setAttribute("BValue", "B");
ServletContext context= pageContext.getServletContext();
RequestDispatcher rd= context.getRequestDispatcher("/MyServlet");
rd.forward(pageContext.getRequest(),pageContext.getResponse());
Help me !! Thanks in advance.