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:
getServletContext().setAttribute("variableName",object);
Then u have to forward that request to other servlet by
using that procedure,
RequestDispatcher rd=getServletContext
().getRequestDispatcher("/servlet");
rd.forward(request,response);
U can get that information from that servlet by using the
method::
getServletContext().getAttribute("variableName");
| Is This Answer Correct ? | 23 Yes | 10 No |
Post New Answer View All Answers
What is the use of servlet context?
What is the directory structure of web application?
What is called servlet container?
What are session variable in servlets?
Which httpsession object is used to view and manipulate information about a session?
List the Different types of servlet?
What do you mean by deployment descriptor?
Who is responsible for writing a constructor?
What is the use of servlet wrapper classes?
What are important features of Servlet 3?
Which event is fired at the time of session creation and destroy?
What are the different methods involved in generic servlet?
What is the difference between genericservlet and httpservlet
What are the differences between servlet context vs servlet config?
When is the servlet instance created in the life cycle of servlet? What is the importance of configuring a servlet?