Solved

what is the difference betn jsp forward tag and servelt send redirect?

Posted on 2001-08-28
6
340 Views
Last Modified: 2012-06-27
Hi

What is the core difference betn

<jsp:forward /> and sendRedirect() method.

waiting for answer.
0
Comment
Question by:paku
6 Comments
 
LVL 12

Accepted Solution

by:
ahosang earned 50 total points
ID: 6435323
sendRedirect() tells the browser to look up the new URL - another connection. It is like a totally new request.

<jsp:forward> is handled on the server, and that gives control to the destination page(keeping all the request data). Also, the URL using forward will be unchanged, whereas obviously with sendRedirect(), you will end up with a different URL. This may have consequences for relative URL's etc.

0
 
LVL 3

Expert Comment

by:black
ID: 6439243
one other thing is you can only forward to another resource or jsp that is within your web app. so if you want to redirect to a resource within your page use forward because it's all done on the server, it should be quicker and less traffic, but if you're redirecting to an external resource use response.sendRedirect(url) method.
0
 
LVL 1

Expert Comment

by:sumeetsh
ID: 6444379
hi

Just to explain further, <jsp:forward> forwards a request internally within the servlet engine, not by redirecting the client -- which is why the client's browser never updates the URL. As far as the browser knows, it made one request and got one response.

This is also why you need to use response.sendRedirect() or a meta tag to forward to an external page or to a local page in another language (e.g. PHP) that needs to be run through its own filter.

Regards
sumeet
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Expert Comment

by:Moondancer
ID: 6881025
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if still open in seven days.  Please post closing recommendations before that time.

Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.  Anytime you have questions which are LOCKED with a Proposed Answer but does not serve your needs, please reject it and add comments as to why.  In addition, when you do grade the question, if the grade is less than an A, please add a comment as to why.  This helps all involved, as well as future persons who may access this item in the future to seek help.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.12042039.html
http://www.experts-exchange.com/questions/Q.20000226.html
http://www.experts-exchange.com/questions/Q.20003260.html
http://www.experts-exchange.com/questions/Q.20087455.html
http://www.experts-exchange.com/questions/Q.20089805.html
http://www.experts-exchange.com/questions/Q.20094072.html
http://www.experts-exchange.com/questions/Q.20102954.html
http://www.experts-exchange.com/questions/Q.20105249.html
http://www.experts-exchange.com/questions/Q.20175437.html
http://www.experts-exchange.com/questions/Q.20265897.html
http://www.experts-exchange.com/questions/Q.20268452.html


To view your locked questions, please click the following link(s) and evaluate the proposed answer.
http://www.experts-exchange.com/questions/Q.11962239.html
http://www.experts-exchange.com/questions/Q.20078199.html
http://www.experts-exchange.com/questions/Q.20080442.html
http://www.experts-exchange.com/questions/Q.20138500.html
http://www.experts-exchange.com/questions/Q.20174850.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643

Moderators will finalize this question if still open in 7 days, by either moving this to the PAQ (Previously Asked Questions) at zero points, deleting it or awarding expert(s) when recommendations are made, or an independent determination can be made.  Expert input is always appreciated to determine the fair outcome.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 
LVL 12

Expert Comment

by:ahosang
ID: 6881355
Don't normally try to claim any of these, but I truly think my answer pretty much covers the question(and was first on the board).

Anyone disagrees please say.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6898023
Thank you, finalized today by EE Moderator.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Unable to open debugger port in Intellij idea 6 88
strDist challenge 35 84
word0 challenge 4 54
for i loop in grovy 1 32
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now