What is difference between Forward() and sendRedirect()
methode?
Answer Posted / shakir khan
The RequestDispatcher forward and include methods are
internal to a servlet container and does not affect the
public url of the webresource.
forward() are excute on the server side.
when a forward() is invoked,the request is sent to another
resource on the server without the client being inform that
a different resource is going to process the request.This
occurs completely with in the webcontainer.
sendRedirect() excutes on the client side.
When a sendRedirect()is invoked,it causes the webcontainer
return to the browser,indicating that a new url should be
requested because the browser issues a completely new
request,any object that are stored as request attributes
before the redirect occurs will be lost.
This extra round trip,a redirect is slower than forward.
| Is This Answer Correct ? | 45 Yes | 3 No |
Post New Answer View All Answers
Define the lifecycle for executing a jsp page.
How can we include static files in the jsp page?
What is the functionality of actionservlet and requestprocessor?
What do you mean by the servlet chaining?
What is the servletconfig object?
Which method of the httpservletrequest object is used?
When a client request is sent to the servlet container, how does the container choose which servlet to invoke?
Explain servlet.
Why is http protocol called as a stateless protocol?
Which exception is thrown if the servlet is not initialized properly?
What is webservlet?
Why is a constructor needed in a servlet even if we use the init method?
How to get the actual path of servlet in server?
What is a generic servlet?
What is new in ServletRequest interface ? (Servlet 2.4)