What is difference between Forward() and sendRedirect()
methode?
Answer Posted / shakir khan
The RequestDispatcher forward and include methods are
internal to a servlet container and does not affect the
public url of the webresource.
forward() are excute on the server side.
when a forward() is invoked,the request is sent to another
resource on the server without the client being inform that
a different resource is going to process the request.This
occurs completely with in the webcontainer.
sendRedirect() excutes on the client side.
When a sendRedirect()is invoked,it causes the webcontainer
return to the browser,indicating that a new url should be
requested because the browser issues a completely new
request,any object that are stored as request attributes
before the redirect occurs will be lost.
This extra round trip,a redirect is slower than forward.
| Is This Answer Correct ? | 45 Yes | 3 No |
Post New Answer View All Answers
What is the dispatcher servlet?
Differentiate between the web server and application server?
What is called servlet mapping?
How a servlet is unloaded?
Is servlet a framework?
What is a servlet context object?
Why is init() method is used in servlets?
What is session tracking?
Why is servlet used?
What is the difference between CGI and Servlet?
List the Different types of servlet?
What is api in servlet?
Can you send an authentication error from a servlet?
What are the different methods of session management in servlets?
What is cookie? Why is cookie used?