Re: [4.1] Howto create an ILink for a page

2008-01-18 Thread Ulrich Stärk

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [4.1] Howto create an ILink for a page

2008-01-18 Thread Igor Drobiazko
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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Best regards,

Igor Drobiazko


[4.1] Howto create an ILink for a page

2008-01-18 Thread Andy Pahne


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]