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
How httpservlet is different from the genericservlet?
Can we use the constructor, instead of init(), to initialize servlet?
Once the destroy() method is called by the container, will the servlet be immediately destroyed? What happens to the tasks(threads) that the servlet might be executing at that time?
If some new data has entered the database, explain how can a servlet refresh automatically?
Explain jsessionid and when is it created?
What is difference between jsp and servlet?
What is the difference between 2 types of servlets?
When a client request is sent to the servlet container, how does the container choose which servlet to invoke?
How do you create a cookie using servlet?
What are the drawbacks of cgi?
Which event is fired at the time of setting, getting or removing attribute from application scope?
What is servlet invoker?
What is the difference between Servlets and Applets?
What is the difference between using getSession(true) and getSession(false) methods?
Explain the servlet filter.