You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Leo Sakhvoruk <le...@gmail.com> on 2006/10/24 05:09:58 UTC

ILink return type for page listener.

I'm trying to figure out how to use an ILink return type for a listener 
method in my page. I'm wanting to use it for the purpose of 
redirect-after-post in order so that the page the user is sent to 
displays the correct URL for it for page refreshes and user tracking 
statistics.

It seems ok for pages that don't require parameters but how would I 
construct an ILink for a page that renders data that is passed to it via 
parameters and such? The page service doesn't handle that so what 
service should I use when constructing a link or is there even a way to 
do that?

Thanks in advance.

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


Re: ILink return type for page listener.

Posted by jimlaren <ji...@21cn.com>.
Your page class define (Example YourBasePageClass):

         @InjectObject("engine-service:external")
	public abstract IEngineService getExternalService();

	public ILink getExternalLink(String pageName, Object[] parameters) {
		ExternalServiceParameter esp = new ExternalServiceParameter(pageName,
				parameters);
		return getExternalService().getLink(false, esp);
	}

Your require parameters page class:

public abstract class YourPageClass extends BasePage implements
		IExternalPage {
         public abstract void setName(String name);
	public void activateExternalPage(Object[] parameters, RequestCycle cycle) {
	    setName(parameters[0].toString()));
	}

}

invoke:

public ILink yourListenerMethod(){
          return getExternalLink("YourPageClass","your name");
}


Leo Sakhvoruk wrote:
> I'm trying to figure out how to use an ILink return type for a listener 
> method in my page. I'm wanting to use it for the purpose of 
> redirect-after-post in order so that the page the user is sent to 
> displays the correct URL for it for page refreshes and user tracking 
> statistics.
> 
> It seems ok for pages that don't require parameters but how would I 
> construct an ILink for a page that renders data that is passed to it via 
> parameters and such? The page service doesn't handle that so what 
> service should I use when constructing a link or is there even a way to 
> do that?
> 
> Thanks in advance.
> 
> ---------------------------------------------------------------------
> 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