What is difference between Forward() and sendRedirect()
methode?
Answer Posted / farhaananwar
Foward action is done at server site without interference of
web browser even the old URL is not changed whereas request
is forwarded to new resource hence forward action is faster
than redirect action. when forward operation is performed
request attributes and session attributes persists.
In case of redirection. servlet container sends the
response to clien web browser by setting status to
HttpServletRequest.SC_TEMPORARY_REDIRECT and location header
to the new URL address where browser will have to redirect
new request automattically without interference of client.
when browser redirect new request to resource, the URL in
web browser changed. This proccess is slower than forward
because server send response to browser telling that
resource requested is moved temporary to other resource and
need redirction and then browser take action. The request
paramters are persist in new redirect request.
| Is This Answer Correct ? | 1 Yes | 7 No |
Post New Answer View All Answers
What is war file?
Which event is fired at the time of session creation and destroy?
What are the exceptions thrown by servlets? Why?
Where do you define dispatcherservlet?
Is that servlet is pure java object or not?
What are the important functions of filters?
How can you push data from an Applet to a Servlet?
What is httpservlet class?
How do servlets work?
What's the difference between servlets and applets?
What exactly are the functions of servlet?
What is meant by cookies?
How can you create a session in servlet?
What is java servlet?
How to get the current httpsession object?