0

I simply want to forward a request of one servlet to another servlet. Authentication Servlet gets a request from a jsp page and thus authenctication servlet passes the request to another Addtocart servlet.
AuthenticationServlet Code:

RequestDispatcher rd= request.getRequestDispatcher("/Addtocart");
        rd.forward(request, response);
response.sendRedirect("Addtocart");

Addtocart servlet code:

String pid = request.getParameter("txtproductid") ;
        String pname = request.getParameter("txtproductname");
        String pprice = request.getParameter("txtproductprice");
        out.println(pid);
        out.println(pname);
        out.println(pprice);

However not the desired output I suppose some problem in my code... Do rectify it!!! thank you in advance

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Rameshwar Soni
0
RequestDispatcher rd= request.getRequestDispatcher("/Addtocart");

I think it should have been

RequestDispatcher rd= request.getRequestDispatcher("Addtocart");
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.