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
What is the servlet?
What are the life-cycle methods for a servlet?
What is meant by session? Tell me something about httpsession class?
What is servlet lazy loading?
Describe some assignments that are executed by servlet container?
How can you use a servlet to generate a plain text instead of html?
How to get the server information in a servlet?
What's the difference between authentication and authorization?
Why jsp is better than servlet?
Explain servlet life cycle?
What are the types of Session Tracking ?
Explain the difference between servletconfig and servletcontext in servlet?
What is pure servlet?
What are common tasks performed by Servlet Container?
Difference between forward() method and sendredirect() method ?