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
What are the types of Session Tracking ?
When jsessionid is created?
What is war file?
What are the differences between forward() method and sendredirect() methods?
What is servlet configuration?
Is it possible to have a constructor inside the servlet?
How to get the path of servlet in the server?
What is the use of httpservletrequestwrapper?
When a client request is sent to the servlet container, how does the container choose which servlet to invoke?
What is http servlet?
Why HttpServlet class is declared abstract?
How we can get ip address of client in servlet?
What do you mean by deployment descriptor?
What is meant by session? Tell me something about httpsession class?
Can filter be used as request or response?