You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Veentjer - Anchor Men <p....@anchormen.nl> on 2005/06/02 09:33:14 UTC

Example of query params in ExternalLink

I have been looking for an example how to use query parameters with the ExternalLink. I know the ExternalLink can have a array of parameters.. and it can access the request context to catch the query parameters. But is there no way to fill in those query parameters on the Page properties?
 
so a foo?firstname=peter
 
would be set to:
 
abstract class PersonPage{
   abstract String getFirstname();
   abstract void setFirstname(String firstname);
}
 
And why does the externallink have an array of parameters? If the link is external the array with properties could never be set from the outside. 

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


Re: Example of query params in ExternalLink

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jun 2, 2005, at 3:33 AM, Peter Veentjer - Anchor Men wrote:

> I have been looking for an example how to use query parameters with  
> the ExternalLink. I know the ExternalLink can have a array of  
> parameters.. and it can access the request context to catch the  
> query parameters. But is there no way to fill in those query  
> parameters on the Page properties?
>
> so a foo?firstname=peter
>
> would be set to:
>
> abstract class PersonPage{
>    abstract String getFirstname();
>    abstract void setFirstname(String firstname);
> }
>
> And why does the externallink have an array of parameters? If the  
> link is external the array with properties could never be set from  
> the outside.


ExternalLink will take in parameters from the URL that look like  
&sp=Sfoo&sp=Sbar.... and use the "sp" parameters in order in that  
array after unsqueezing the data (the "S" prefix means its a String).

I personally find this awkward.  A custom link and service  
combination can make things cleaner in the way you're proposing - in  
fact I've done this very thing and posted about it here with a  
ParamLink and ParamService (for Tapestry 4.0).  I pass a Map in to a  
listener filled with named parameters.  It could also populate page  
properties with some modifications - but that gets into a discussion  
of whether some properties should not be alterable from the URL or not.

In summary - I agree that ExternalLink/Service are less than ideal  
but there is flexibility to make it better.

     Erik


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