How do you pass the data from one servlet to another
servlet?
Answer Posted / harish
Using Request Dispatcher, you can send the values and
forward to another page.
ServletContext.getRequestDispatcher();
reqDispatcher.forward(req,res)
Forwards a request from a servlet to another resource
(servlet, JSP file, or HTML file) on the server.
reqDispatcher.include(req,res)
Includes the content of a resource (servlet, JSP page, HTML
file) in the response.
| Is This Answer Correct ? | 80 Yes | 22 No |
Post New Answer View All Answers
What is servlet and its use?
What is the difference between the getrequestdispatcher(string path) method of javax.servlet.servletrequest interface and javax.servlet.servletcontext interface?
What is URL Encoding?
Can you send an authentication error from a servlet?
What is a java servlet?
What are all the ways for session tracking?
Which httpsession object is used to view and manipulate information about a session?
How can we implement a jsp page?
Why is a constructor needed in a servlet even if we use the init method?
When a client request is sent to the servlet container, how does the container choose which servlet to invoke?
What is meant by session? Tell me something about httpsession class?
Why do we have servlet listeners?
What is the web server used for running the Servlets?
Is java servlet still used?
How do we call one servlet from another servlet?