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

RequestDispatcher rd= request.getRequestDispatcher("/Addtocart");

I think it should have been

RequestDispatcher rd= request.getRequestDispatcher("Addtocart");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.