You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andy Pahne <ap...@net22.de> on 2008/01/18 12:30:35 UTC
[4.1] Howto create an ILink for a page
Hello,
I have a listener method with the return type of ILink. It needs to
return ILink, because in some cases the user will be forwarded to
external pages and I created those links with
new StaticLink(url)
In some other cases the listener method should return an ILink to an
internal tapestry page. How can I construct an ILink that links to a page.
Example:
public ILink accommodationSelectAction(Hotel hotel) {
switch (someCondition) {
case CONDITION_1:
IPage nextPage = getNextPage();
return ????
case CONDITON_2:
return new StaticLink(someUrl);
default:
throw new ApplicationRuntmieException("boo boo");
}
}
Thanks,
Andy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [4.1] Howto create an ILink for a page
Posted by Ulrich Stärk <ul...@spielviel.de>.
You should be able to do something like this:
@InjectObject("engine-service:page")
public abstract IEngineService getPageService();
and then construct your link like
String pageName = "SomePage";
ILink pageLink = getPageService().getLink(false, pageName);
Uli
Andy Pahne schrieb:
>
> Hello,
>
> I have a listener method with the return type of ILink. It needs to
> return ILink, because in some cases the user will be forwarded to
> external pages and I created those links with
> new StaticLink(url)
>
> In some other cases the listener method should return an ILink to an
> internal tapestry page. How can I construct an ILink that links to a page.
>
>
> Example:
>
> public ILink accommodationSelectAction(Hotel hotel) {
>
>
> switch (someCondition) {
>
> case CONDITION_1:
> IPage nextPage = getNextPage();
> return ????
>
> case CONDITON_2:
> return new StaticLink(someUrl);
>
> default:
> throw new ApplicationRuntmieException("boo boo");
> }
>
> }
>
>
>
> Thanks,
> Andy
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [4.1] Howto create an ILink for a page
Posted by Igor Drobiazko <ig...@gmail.com>.
You can throw new PageRedircetException("PageName"); or you can use the page
service:
http://tapestry.apache.org/tapestry4.1/apidocs/org/apache/tapestry/engine/PageService.html
To inject the page service, do following:
@InjectObject("engine-service:page")
public abstract IEngineService getPageService();
On Jan 18, 2008 12:30 PM, Andy Pahne <ap...@net22.de> wrote:
>
> Hello,
>
> I have a listener method with the return type of ILink. It needs to
> return ILink, because in some cases the user will be forwarded to
> external pages and I created those links with
> new StaticLink(url)
>
> In some other cases the listener method should return an ILink to an
> internal tapestry page. How can I construct an ILink that links to a page.
>
>
> Example:
>
> public ILink accommodationSelectAction(Hotel hotel) {
>
>
> switch (someCondition) {
>
> case CONDITION_1:
> IPage nextPage = getNextPage();
> return ????
>
> case CONDITON_2:
> return new StaticLink(someUrl);
>
> default:
> throw new ApplicationRuntmieException("boo boo");
> }
>
> }
>
>
>
> Thanks,
> Andy
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Best regards,
Igor Drobiazko