You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Chappuis J.-Vincent" <vi...@idbsoft.ch> on 2001/03/07 15:33:29 UTC

template redirection

Hi all !

In an action class, I must redirect the next screen. I use this code but it doesn't work.

...
data.setScreen(screen);
 
 // use a redirect (so the displayed URL makes sense to end user)
 DynamicURI uri = new DynamicURI(data);
 uri.setScreen(screen);
 data.getTemplateInfo().setScreenTemplate(screen + ".xsl");
 data.setRedirectURI( uri.toString() );
 data.setStatusCode(302);
...

Any idea ? 

Regards.


Re: template redirection

Posted by Jon Stevens <jo...@latchkey.com>.
on 3/7/01 6:33 AM, "Chappuis J.-Vincent" <vi...@idbsoft.ch>
wrote:

> In an action class, I must redirect the next screen. I use this code but it
> doesn't work.
> 
> ...
> data.setScreen(screen);
> 
> // use a redirect (so the displayed URL makes sense to end user)
> DynamicURI uri = new DynamicURI(data);
> uri.setScreen(screen);
> data.getTemplateInfo().setScreenTemplate(screen + ".xsl");
> data.setRedirectURI( uri.toString() );
> data.setStatusCode(302);

You are using this incorrectly. You don't need to use a 302 code. You simply
use the setRedirect() or setTemplate() method (read the javadoc for
details). It does an "internal" redirect within the Turbine system which can
be done because an Action is executed before the Screen is, therefore you
can "override" what the next screen is before it is executed.

-jon

-- 
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
<http://jakarta.apache.org/velocity/ymtd/ymtd.html>