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 servlet chaining?
What is the difference between sendredirect() and forward() in a servlet?
What is the need of servlet filters?
What do you mean by cgi in servlet?
Explain load on start-up and its importance?
What are the types of an http request?
Why the container loads server at the application startup and how?
What are the features added in Servlet 2.5?
What is cookies in servlet with example?
What are the functions of the servlet container?
what is the different between a servlet and a cgi? Why do you go for servlet rather than cgi?
Tell us something about servletcontext interface.
What is difference between server and servlet?
Explain url encoding?
What is MIME Type?