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

Explain the difference between servletconfig and servletcontext in servlet?

770


What is the advantage of Servlets when compared with other server side technologies?

2074


What is the difference between Servlet Request and Servlet Context when calling a Request Dispatcher?

827


How we can create war file in servlet?

842


What are the differences between servlet context vs servlet config?

811


Explain the working of service() method of a servlet.

693


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

793


Is java servlet still used?

755


How do you define a servlet?

717


What are the different methods involved in generic servlet?

803


How can we invoke another servlet in a different application?

918


What is load-on-startup in servlet?

794


Write a program to show the functionality of doget and dopost method?

884


What is meant by servlet? What are the parameters of the service method?

790


How we can get ip address of client in servlet?

734