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
List out difference between a JavaBean from a Servlet?
What is http servlet in java?
Explain the custom jsp tags and the beans.
What is the difference between the getrequestdispatcher(string path) method of javax.servlet.servletrequest interface and javax.servlet.servletcontext interface?
What is called servlet mapping?
What do you mean by httpservlet?
What are the phases of servlet life cycle?
What is servlet interface?
What do you mean by the servlet chaining?
What is java servlet?
What do you mean by httpservlet and how it is different from the genericservlet?
Explain how does JSP handle run-time exceptions?
What do you mean by chaining in servlet?
What is the difference between forward () and sendredirect () functions in servlet? Explain
What is the disadvantage of cookies?