954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Request Dispatcher

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

mith_cool
Junior Poster in Training
56 posts since Jan 2010
Reputation Points: 10
Solved Threads: 3
 
RequestDispatcher rd= request.getRequestDispatcher("/Addtocart");


I think it should have been

RequestDispatcher rd= request.getRequestDispatcher("Addtocart");
Rameshwar Soni
Newbie Poster
19 posts since Aug 2011
Reputation Points: 19
Solved Threads: 5
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You