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 the use of httpservletrequestwrapper and httpservletresponsewrapper?
What are the kinds of http requests?
Explain the difference between servletconfig and servletcontext in servlet?
What is SingleThreadModel interface?
What do you mean by mime type?
What is URL Encoding?
How can we invoke another servlet in a different application?
What is the use of httpservletrequestwrapper?
What is Client-Server Computing?
What do you mean by request dispatcher in servlet? Also explain its methods.
What is the difference between using getSession(true) and getSession(false) methods?
How to get the IP address of client in servlet?
Explain url encoding in servlet?
explain the advantages of servlet life cycle?
Why are http servlets used in programming?