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 are the different methods involved in the process of session management in servlets?
What is a servlet context?
Describe some assignments that are executed by servlet container?
Can we fetch the attributes related to a servlet on a different servlet?
Why the container loads server at the application startup and how?
Explain the features are in servlet 3?
What is Servlets and explain the advantages of Servlet life cycle?
What do you mean by a filter and how does it work?
Explain jsessionid and when is it created?
What are the differences between the servletconfig interface and the servletcontext interface?
What's the architecture of a servlet package?
What is the difference between using getSession(true) and getSession(false) methods?
What is preinitialization of a servlet?
what is multiple server?
Explain request dispatcher and its methods.