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 need of servlet filters?
What are the benefits of using servlet over cgi?
Explain url encoding?
Elucidate servlet attributes and its scope?
What is the use of welcome-file-list?
Explain load on start-up and its importance?
How can the session in servlet be destroyed?
What are the mechanisms used by a servlet container for maintaining session information?
Which java application server is the best?
How do you load an image in a Servlet?
What are the jobs performed by servlets?
Differentiate between the web server and application server?
Is servlet a server side scripting language?
What are the difference between RMI and Servlets?
What is the capacity the doget can send to the server?