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
Explain how to improve Servlet Performance?
What are the functions of the servlet container?
What is session tracking?
If my browser does not support cookie, and my server sends a cookie instance what will happen?
What is the difference between the http servlet and generic servlet?
Why servlet is used as controller ? Not JSP? I want complete explation?
Which interface should be implemented by all servlets?
Explain in brief the directory structure of a web application?
What is the use of servlet context?
Why HttpServlet class is declared abstract?
What is http servlet?
If servlet receives multiple requests, how many objects will it create?
What are the steps involved in placing a servlet within a package?
How do we translate jsp?
What is difference between PrintWriter and ServletOutputStream?