How do you pass the data from one servlet to another
servlet?

Answer Posted / vinod muda

In First Servlet i.e Test

String name = "Vinod";
request.setAttribute("name",name);
RequestDispatcher dis = request.getRequestDispatcher
("Test2");
dis.forward(request, response);
---------------------------------------
Now in Second Servlet i.e Test2

String name = (String) request.getAttribute("name");

Is This Answer Correct ?    29 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between Servlets and Applets?

626


Who is responsible to create the object of servlet?

805


Describe servlet?

656


What are the different methods involved in generic servlet?

656


Differentiate between the web server and application server?

652






Explain servlet events?

641


What is the workflow of a servlet?

795


What is the difference between using getSession(true) and getSession(false) methods?

646


Why is servlet used?

775


Which protocol will be used by browser and servlet to communicate

656


How many servlet objects are created?

649


What is servlet and list its types?

619


What is a servlet-to-servlet communcation?

731


What is a java servlet?

635


What is the purpose of inter-servlet communication?

671