Solved

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

Posted on 2001-08-28
6
348 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
xampp tool 12 56
ejb wildfly example 2 27
sql import cannot be resolved jsp 3 49
How to configure empty element in XML Document parser? 15 36
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

828 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