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
HttpServletResponse.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 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What’s the difference between genericservlet and httpservlet?

534


Name the different ways of session tracking.

571


What is the difference between get and post methods?

604


hi actully i hav form columns with origin and destination names .as like as i need to create one more column with name amount. my requirement is when i select origin and destination columns automatically i need to get amount from database.how can i. please tel me with relative code

2286


Explain servlet events?

566






Can you create a deadlock condition on a servlet?

589


How does java thread pool work?

548


How do cookies work in servlets?

583


What do you understand by mime type?

564


What are the differences between servlet context vs servlet config?

582


Where do you define dispatcherservlet?

552


What is SingleThreadModel interface?

676


Hi frnd can i any one kindly can post for me portlet,hibernate and spring example application and with flow explantion configuration using Jdeveloper.and related links ar tutorials kindly please send me .its urgent for me .thanks in advance...........else can any one send to kondaiah.goddeti@gmail.com

1747


What do you mean by singlethreadmodel interface?

582


What are the two important api's in for servlets?

590