what is difference between redirect and forward method?
Answers were Sorted based on User's Feedback
Answer / sailaja
In sendRedirect new request is generated forwarded to the
specified page.where as in forward old reuest is forwarded
to the specifed page
Is This Answer Correct ? | 30 Yes | 5 No |
Answer / vipin gupta trainer
There is a difference between the
HttpResponse.sendRedirect() method and the
RequestDispatcher.foward() method .
the sendRedirect() method leverage Https built in redirect
features to send a message back to the client and foce the
visitors Browser to request a new page .
the forward() method transfer the HttpServletRequest and
HttpServletResponse methods to the indicated file on the
web server. the forward() method never communicates with
the visitors browser .
Is This Answer Correct ? | 19 Yes | 3 No |
Answer / jsptube
I found this good tutorial that explains <a
href="http://www.jsptube.com/examples/response-sendredirect-servlet.html">
Difference between redirect and forward </a>
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / sayed2010
Forward:
1-It takes place internally by the servlet(Server side
operation.
2-The browser is completely unaware that it has taken place.
3-The original request remains unchanged.
4-A browser reload of the resulting page will simply repeat
the original url and the original request.
Redirect:
1-Is a two step process.
2- 1st step-> is that the browser is instructed to fetch a
new url differs from the original url.
3-It require two browser requests.
Object placed in the first request will not be available to
the second request.
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / javahelper
forward() is for sending the data between two applications
in same server only,but sendRedirect() is for sending the
data between two applications between two servers also,
one more different is in forward() mechanism one
request,one response objects will be create but in
sendRedirect() mechanism two request and two response
objects will be create.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / kuljeet singh
forward() method sendRedirect() method
1) forward() sends the same request to another resource. 1) sendRedirect() method sends new request always because it uses the URL bar of the browser.
2) forward() method works at server side. 2) sendRedirect() method works at client side.
3) forward() method works within the server only 3) sendRedirect() method works within and outside the server.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / saroja dachavaram
in case of forward,request processing takes place using a
single request.
in case of redirect,request processing takes place using a
two request.
Is This Answer Correct ? | 9 Yes | 12 No |
Answer / nitin
IN forward ,,we can forward on te just another next page
where we working rite now,,,u have to move alvz ahead not
back side pages.
and in send redirect we also can go back side ,mean u just
have to give the name of the page where u have to redirect
the page.
Is This Answer Correct ? | 4 Yes | 9 No |
Answer / pratique suhane
in case of forward data can not be send as parameters
whereas in case of redirect data can be send as parameter.
Is This Answer Correct ? | 3 Yes | 12 No |
Answer / v.kannan
In sendRedirect Each and Every time new Client side Object
will Create.Changes will be updated in request Pages.
Session Object will not alive.
In sendRedirect we can transfer the control(request) from
one webserver(welogic) to another one webserver(Jboss).
It's not possible in jsp:forward
Is This Answer Correct ? | 8 Yes | 19 No |
Are application, pageContext and object of ServletContext same or not?
What are implicit objects?
How to find the hidden answers present in an online exam?
What is an expression language?
which is the place to learn java in chennai..
What is the jsp:getproperty action?
Which package does jsp api consist of?
How can I implement a thread-safe jsp page? What are the advantages and disadvantages of using it?
What are different types of comments used in jsp?
hi friends...i created sessions in my login page i can able to create a session but after loging out again i can able access the pages by its addresses. i think u may got problem if possible post me small example for login with sessions including database
How do I use comments within a jsp page?
What is expression tag in jsp?