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
Explain url encoding in servlet?
How do you invoke a servelt?
Explain the steps involved in placing a servlet within a package?
Difference between java beans & servlets?
What is the effective way to make sure all the servlets are accessible only when user has a valid session?
Is java servlet still used?
What are the functions of the servlet container?
Describe servlet?
What is the inter-servlet communication?
Why the container loads server at the application startup and how?
Whether we can get deadlock situation in servlets?
How can you start a jta transaction from a servlet deployed on jboss?
What are the annotations used in servlet 3?
What is ServletContext object?
What is difference between GenericServlet and HttpServlet?