How do you pass the data from one servlet to another
servlet?
Answer Posted / kuru
for example if you want to pass your name from one servlet
to another,
in fiest servlet file....
String name = "Tom"
request.setAttribute("name",name);
RequestDispatcher dis = request.getRequestDispatcher
("Servlet2");
request.Forward(request,response);
in second servlet file....
request.getAttribute("name");
//this line will display "Tom"
| Is This Answer Correct ? | 46 Yes | 20 No |
Post New Answer View All Answers
What are all the ways for session tracking?
What is load-on-startup in servlet?
What are the new features added to servlet 2.5?
What’s the difference between genericservlet and httpservlet?
What is the difference between jsp and servlet life cycle?
Can we override destroy method in servlet?
What do you mean by the servlet chaining?
List the Different types of servlet?
What are the types of servlet?
How can you create a session in servlet?
Why do we need a constructor in a servlet if we use the init method?
what is multiple server?
What is Servlet API used for connecting database?
What is dispatcher servlet?
Explain the difference between generic servlet and http servlet?