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
Who is responsible to create the object of servlet?
What is the directory structure of a war file?
What is difference between PrintWriter and ServletOutputStream?
How can the session in servlet be destroyed?
What is servlet and its types?
What exception should be thrown when servlet is not properly initialized?
What is the type of method for sending request from http server?
How forward () method is different from send redirect () method?
Why is httpservlet declared abstract?
What are the life-cycle methods for a servlet?
How to find whether a parameter exists in the request object?
What do you mean by session tracking?
How can a servlet be used to generate plain text instead of html?
How to get ip address in jsp login page and how to validate like 127.1.0.1 all should not be greater than 255
If a servlet is not properly initialized, what exception may be thrown?