You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Kertis, Dennis" <dk...@vocollect.com> on 2004/03/25 17:47:14 UTC

Passing multiple parameters in a link

Is there a way to pass multiple parameters to a link without using an array?
I'm iterating over a collection and do not want to construct an intermediate
array.

 

i.e.  I am iterating over a employee object in a Foreach loop and I want to
send Employee name and employee number to the next page.  I need to do
something like this:

 

<component id="employees" type="Foreach">

    <binding name="source" expression="employees"/>

    <binding name="value" expression="employee"/>

</component>

<component id="mainLink" type="DirectLink">

    <binding name="listener" expression="listeners.invokeFunction"/>

    <binding name="parameters" expression="employee.name"/>

    <binding name="parameters" expression="employee.number"/>

</component>

 

Although it seems I can only pass one parameter.  I also do not want to pass
employeeID because that would make an extra round trip to the DB.

 

Thanks,

Dennis

 

 


Re: Passing multiple parameters in a link

Posted by John Studarus <st...@jhlconsulting.com>.
  Why don't use setup the page rather than passing
paramters?  This might be an easier way.  (Sample
code follows.)  Passing parameters on the URL is
tricky since this means you have to read them
on the other side.

        John

  
 
<component id="employees" type="Foreach">
    <binding name="source" expression="employees"/>
    <binding name="value" expression="employee"/>
</component>

<component id="mainLink" type="DirectLink">
    <binding name="listener" expression="listeners.invokeFunction"/>
    <binding name="parameters" expression="employee.name"/>
    <binding name="parameters" expression="employee.number"/>
</component>

public abstract Employee getEmployee() ;  // this is the foreach iterator value

public void invokeFunction(IRequestCycle cycle) {

  EmployeePage next_page = (EmployeePage) cycle.getPage("EmployeePage");

  next_page.setEmployeeName(getEmployee().getName()) ;
  next_page.setEmployeeNumber(getEmployee().getNumber()) ;

  cycle.activate(next_page) ;

}



  


On Thu, Mar 25, 2004 at 11:47:14AM -0500, Kertis, Dennis wrote:
> Is there a way to pass multiple parameters to a link without using an array?
> I'm iterating over a collection and do not want to construct an intermediate
> array.
> 
>  
> 
> i.e.  I am iterating over a employee object in a Foreach loop and I want to
> send Employee name and employee number to the next page.  I need to do
> something like this:
> 
>  
> 
> <component id="employees" type="Foreach">
> 
>     <binding name="source" expression="employees"/>
> 
>     <binding name="value" expression="employee"/>
> 
> </component>
> 
> <component id="mainLink" type="DirectLink">
> 
>     <binding name="listener" expression="listeners.invokeFunction"/>
> 
>     <binding name="parameters" expression="employee.name"/>
> 
>     <binding name="parameters" expression="employee.number"/>
> 
> </component>
> 
>  
> 
> Although it seems I can only pass one parameter.  I also do not want to pass
> employeeID because that would make an extra round trip to the DB.
> 
>  
> 
> Thanks,
> 
> Dennis
> 
>  
> 
>  
> 

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


Re: Passing multiple parameters in a link

Posted by "based@free.fr" <ba...@free.fr>.
OGNL it !,
<binding name="parameters" 
expression="{employee.name,employee.number}"/>


Kertis, Dennis wrote:
> Is there a way to pass multiple parameters to a link without using an array?
> I'm iterating over a collection and do not want to construct an intermediate
> array.
> 
>  
> 
> i.e.  I am iterating over a employee object in a Foreach loop and I want to
> send Employee name and employee number to the next page.  I need to do
> something like this:
> 
>  
> 
> <component id="employees" type="Foreach">
> 
>     <binding name="source" expression="employees"/>
> 
>     <binding name="value" expression="employee"/>
> 
> </component>
> 
> <component id="mainLink" type="DirectLink">
> 
>     <binding name="listener" expression="listeners.invokeFunction"/>
> 
>     <binding name="parameters" expression="employee.name"/>
> 
>     <binding name="parameters" expression="employee.number"/>
> 
> </component>
> 
>  
> 
> Although it seems I can only pass one parameter.  I also do not want to pass
> employeeID because that would make an extra round trip to the DB.
> 
>  
> 
> Thanks,
> 
> Dennis
> 
>  
> 
>  
> 
> 



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