You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Fabio Mancinelli <ma...@di.univaq.it> on 2003/03/14 11:28:12 UTC

[XEN] Simple question: forward and redirect

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 13 Mar 2003, Ian Hunter wrote:

> Are you redirecting or forwarding to your JSP from that Action?

What is the exact difference between forwarding and redirecting? What are 
their implications?

I searched the Servlet and JSP specs but I haven't found nothing about 
that.

A presto,
Fabio

- -- 
- -----------------------------------------------------------------------------
 Fabio Mancinelli, PhD student     EMail : mancinel@di.univaq.it
 Dipartimento di Informatica         WWW : http://www.di.univaq.it/~mancinel
 Universita' dell'Aquila    
- -----------------------------------------------------------------------------

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6

iD8DBQE+ca7A6dsQbk2R3cMRAruyAKDTfVtCqtF13uyg+oDHw8NpfSIWrgCfa8RB
FKSGdLso4sReqYrbCO2fkcE=
=aSQr
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [XEN] Simple question: forward and redirect

Posted by Fabio Mancinelli <ma...@di.univaq.it>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 14 Mar 2003, Simon Kelly wrote:

> When you forward, you pass control to another class within your current
> application root context.
> 
> When you redirect, you can pass in or out of the context.
> 
What do you mean? Aren't we talking at the HTTP protocol level?
When you say "another class" do you mean another "WEB" object?
I mean, it should be possible to forward/redirect also to a PHP page,
shouldn't it?
The forward/redirect semantics is tied to the Java Framework that we are 
using or is it more general?

And what are the effect of enabling the redirect property of a 
struts action? 

A presto,
Fabio

- -- 
- -----------------------------------------------------------------------------
 Fabio Mancinelli, PhD student     EMail : mancinel@di.univaq.it
 Dipartimento di Informatica         WWW : http://www.di.univaq.it/~mancinel
 Universita' dell'Aquila    
- -----------------------------------------------------------------------------

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6

iD8DBQE+cbSO6dsQbk2R3cMRAmFZAKCjwio1kbnIRqz5oW4bw0g+q0d0pACgmO9m
H+VuLhfCBUUgNi9l0m5D3WA=
=U+8j
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [XEN] Simple question: forward and redirect

Posted by Simon Kelly <ke...@ipe.fzk.de>.
When you forward, you pass control to another class within your current
application root context.

When you redirect, you can pass in or out of the context.

Simon - "If I have this wrong, my site is well sha***d!!"


----- Original Message -----
From: "Fabio Mancinelli" <ma...@di.univaq.it>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, March 14, 2003 11:28 AM
Subject: [XEN] Simple question: forward and redirect


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Thu, 13 Mar 2003, Ian Hunter wrote:
>
> > Are you redirecting or forwarding to your JSP from that Action?
>
> What is the exact difference between forwarding and redirecting? What are
> their implications?
>
> I searched the Servlet and JSP specs but I haven't found nothing about
> that.
>
> A presto,
> Fabio
>
> - --
> - ------------------------------------------------------------------------
-----
>  Fabio Mancinelli, PhD student     EMail : mancinel@di.univaq.it
>  Dipartimento di Informatica         WWW :
http://www.di.univaq.it/~mancinel
>  Universita' dell'Aquila
> - ------------------------------------------------------------------------
-----
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: Made with pgp4pine 1.75-6
>
> iD8DBQE+ca7A6dsQbk2R3cMRAruyAKDTfVtCqtF13uyg+oDHw8NpfSIWrgCfa8RB
> FKSGdLso4sReqYrbCO2fkcE=
> =aSQr
> -----END PGP SIGNATURE-----
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [XEN] Simple question: forward and redirect

Posted by Phil Steitz <ph...@steitz.com>.
Fabio Mancinelli wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Thu, 13 Mar 2003, Ian Hunter wrote:
> 
> 
>>Are you redirecting or forwarding to your JSP from that Action?
> 
> 
> What is the exact difference between forwarding and redirecting? What are 
> their implications?
> 
> I searched the Servlet and JSP specs but I haven't found nothing about 
> that.

Forward <=> RequestDispatcher.forward()
(http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/RequestDispatcher.html)

Redirect <=> HttpServletResponse.sendRedirect()
(http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletResponse.html)

Big difference is that redirect sends an HTTP Response back the browser 
with a redirect header, generating a new request from the browser.  This 
  makes it in general slower and less efficient.  Also, the Request 
object (and anything that you have shoved into it) is not preserved.  On 
the other hand, redirect gives you control over the destination URL. 
Search the archives for full discussion.

hth,

Phil



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org