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
How to get the path of servlet in the server?
What do you mean by cgi in servlet?
When servlet object is created?
Which HTTP method is non-idempotent?
Why do we need a constructor in a servlet if we use the init method?
Why do we have servlet listeners?
What is ServletContext object?
What is servlet configuration?
What’s the difference between sendredirect and forward methods
how the HTML data stored in web server?
What is servlet and its advantages?
Difference between httpservlet and generic servlets?
How can we perform any action at the time of deploying the project?
How can we refresh automatically when new data has entered the database?
What are the differences between servlet context vs servlet config?