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 are different methods of session management in servlets?
When Servlet is unloaded?
What is the need of session tracking in web application?
What is the difference between get and post methods?
What is servlet in tomcat?
How can we refresh automatically when new data has entered the database?
What is a web application and what is it’s directory structure?
Hello, My project requirement is like I need to create a web page using MVC pattern. I hava a bean class, jsp page, servlet, service and dao. My jsp has two fields. One is dropdown list. The option values has to get populated from the database table. The other one is a text box and its value has to come from database table. As of now I have defined the fields in bean class, got the values from database using arraylists in dao class and I called this from service class. Can anyone please tell me the workflow of how the servlet will get this arraylist and populate the arraylist values as dropdown options in jsp page? Also I would like to know the role of bean class in MVC pattern? Thanks in advance!
Write a command to get actual path of a servlet to the server?
What is the web server used for running the Servlets?
How servlet is created?
How does tomcat servlet container work?
What is servlet and how it works?
What is servlet and its types?
What is difference between jsp and servlet?