What’s the difference between forward() and sendredirect() methods?



What’s the difference between forward() and sendredirect() methods?..

Answer / Ram Narayan

The primary difference between forward() and sendRedirect() methods in servlets is their behavior towards the client request and response. The forward() method transfers the control to another servlet within the same application (usually a JSP page), while keeping the original request and response objects intact, without modifying the HTTP headers. On the other hand, sendRedirect() creates a new HTTP redirect message, which means a new request is generated from the client to the newly specified URL, changing the state of the current request.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Servlets Interview Questions

What do you mean by httpservlet and how it is different from the genericservlet?

1 Answers  


How will you pass values from HTML page to the servlet?

1 Answers  


1.HttpSession 2.Hidden fields 3.URL Rewriting these primitive type of Session maintainance. What is the other type of process that could help to maintain the Session? pls Explain the process if u know?

5 Answers   OnMobile,


How can you push data from an Applet to a Servlet?

1 Answers  


What is http servlet? Explain with the help of an example.

1 Answers  


What is the use of httpservletresponsewrapper?

1 Answers  


How many Cookies can a host support?

2 Answers  


What is difference between get and post method?

1 Answers  


What is servlet interface?

1 Answers  


What is servlet instance?

1 Answers  


What do you mean by the servlet chaining?

1 Answers  


Difference between jakarta tomcat and apache Tomcat?

4 Answers   IBM,


Categories