How do you pass the data from one servlet to another
servlet?
Answer Posted / debojit
First of all u have to set the value by setAttribute()
method such as:
request.setAttribute("variableName",object);
Then u have to forward that request to other servlet by
using that procedure,
ServletContext con=request.getServletContext();
RequestDispatcher rd=con.getRequestDispatcher("/servlet");
rd.forward(request,response);
U can get that information from that servlet by using the
method::
getAttribute("variableName");
| Is This Answer Correct ? | 50 Yes | 20 No |
Post New Answer View All Answers
Can servlet have a constructor ?
How the typical servlet code look like ?
What is difference between GenericServlet and HttpServlet?
What are the exceptions thrown by servlets? Why?
What is servlet looping or chaining?
What are the life-cycle methods for a servlet?
Explain how does JSP handle run-time exceptions?
What is meant by a web application
How can we include static files in the jsp page?
Can you create a deadlock condition on a servlet?
How to get the current httpsession object?
How do we call one servlet from another servlet?
What is the difference in between the httpservlet and generic servlet?
Which application server is best for java?
What is the directory structure of web application?