You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by asianCoolz <se...@yahoo.com> on 2010/09/22 12:00:10 UTC

throw new PageRedirectException

with throw new PageRedirectException("NextTapestryPage"); , i was redicectd to
another page, but the url on the browser address bar is not change.   is there
any method i can call "forward", so that use 'forward' to another page 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: throw new PageRedirectException

Posted by Martin Strand <do...@gmail.com>.
On Thu, 23 Sep 2010 04:43:28 +0200, asianCoolz <se...@yahoo.com>  
wrote:

> IEngineService pageService = getPageService();
>>    String pageName = "NextTapestryPage";
>>    ILink link = pageService.getLink(false, pageName);
>>    throw new RedirectException(link.getAbsoluteURL());
>
>
> if page is IPage, and i set parameter to the page.setExtraParameter(abc);
> how to get absoluteurl for this IPage? rathan than "string" that you  
> suggested
> for pageName.

I haven't used Tapestry 4 for a while, but I'm pretty sure that you can  
pass all the parameters to getLink(...) in an array, starting with the  
page name:

IPage page = ...;
Object abc = ...;
String pageName = page.getName();
ILink link = pageService.getLink(false, new Object[] {pageName, abc,  
moreParameters(), etc} );
throw new RedirectException(link.getAbsoluteURL());

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: throw new PageRedirectException

Posted by asianCoolz <se...@yahoo.com>.
IEngineService pageService = getPageService();
>    String pageName = "NextTapestryPage";
>    ILink link = pageService.getLink(false, pageName);
>    throw new RedirectException(link.getAbsoluteURL());


if page is IPage, and i set parameter to the page.setExtraParameter(abc);
how to get absoluteurl for this IPage? rathan than "string" that you suggested
for pageName.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: throw new PageRedirectException

Posted by Martin Strand <do...@gmail.com>.
This is in Tapestry 4, right?
To send the client to a different URL you can throw a RedirectException  
instead:

void redirectToNextPage()
{
   IEngineService pageService = getPageService();
   String pageName = "NextTapestryPage";
   ILink link = pageService.getLink(false, pageName);
   throw new RedirectException(link.getAbsoluteURL());
}

You also need to inject the page service in your page/component class:

@InjectObject("engine-service:page")
public abstract IEngineService getPageService();


On Wed, 22 Sep 2010 12:00:10 +0200, asianCoolz <se...@yahoo.com>  
wrote:

> with throw new PageRedirectException("NextTapestryPage"); , i was  
> redicectd to
> another page, but the url on the browser address bar is not change.   is  
> there
> any method i can call "forward", so that use 'forward' to another page

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: throw new PageRedirectException

Posted by Katia Aresti Gonzalez <ka...@gmail.com>.
http://tapestry.apache.org/tapestry5/guide/pagenav.html

2010/9/22 asianCoolz <se...@yahoo.com>

> with throw new PageRedirectException("NextTapestryPage"); , i was redicectd
> to
> another page, but the url on the browser address bar is not change.   is
> there
> any method i can call "forward", so that use 'forward' to another page
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>