You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Voors Paul <pa...@atp.nl> on 2006/06/26 15:51:00 UTC

Multiple objects in a form

Hello All,

We have a page with a form were we ask the customer standard information about name an address etc. 
We ask the information for multiple customers an for each customer we use a seperate object.
In the form we want to bind the firstName box, lastName box etc to corresponding fields in the objects for eacht costomer. If we use the normal for loop only the last customer is passed the others are lost.
We cannot find an exammple of how to solve this problem. In the for loop documentation the IprimaryKeyConverter is mentioned, but We cannot figure out how to implement this properly.
Can someone help us with an example or advise?


Thanks a lot in advance!



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


Re: Re(2): Multiple objects in a form

Posted by Peter Svensson <ps...@gmail.com>.
And I'm pretty certain that's a yes :)

Cheers,
PS

On 6/26/06, Gentry, Michael (Contractor) <mi...@fanniemae.com>
wrote:
>
> I was just discussing this on the Cayenne list last week.  I chose to
> get the hash code of the object (customer) and return it to the
> keyExpression.  I figured that was probably unique enough for my uses
> (unlikely to have clashes over a small set of objects).  Also, this
> would work for new/uncommitted objects (no primary key) as well as
> persisted ones.  Seems to work OK in my preliminary tests.
>
> HTH,
>
> /dev/mrg
>
>
> -----Original Message-----
> From: Voors Paul [mailto:paul@atp.nl]
> Sent: Monday, June 26, 2006 10:18 AM
> To: Tapestry users
> Subject: Re(2): Multiple objects in a form
>
>
> Peter,
>
> Thanks for the fast reply.
>
> I have an additional question, if you don't mind:
>
> keyExpression="id"
> I presume that the "id" in keyExpression is the (customer)id in the
> (Customer)object.
> Will this work when  i render new / empty objects?
>
> Paul
>
> Peter Svensson (06/26/2006 16:14):
> >In the For component, it is possible to specifiy a "value" parameter,
> which
> >will hold the current object for every pass of the for loop. If we take
> the
> >example from the tapestry page and shorten it a bit;
> >
> ><tr jwcid="@For" source="ognl:customerList" keyExpression="id"
> >      value="ognl:customer" element="tr">
> >    <td><span jwcid="@TextField" value="ognl:customer.fullName"/></td>
> ></tr>
> >
> >
> >Then if you have ten customers in customerList, there will be ten
> textFields
> >shown, and each of those TextFields will call getFullName() on the
> specific
> >customer object when it renders, and call the setFullName(String foo)
> method
> >on the specific customer object when updated. IIRC.
> >
> >Cheers,
> >PS
> >
> >
> >On 26 Jun 2006 15:51:00 +0200, Voors Paul <pa...@atp.nl> wrote:
> >>
> >> Hello All,
> >>
> >> We have a page with a form were we ask the customer standard
> information
> >> about name an address etc.
> >> We ask the information for multiple customers an for each customer we
> use
> >> a seperate object.
> >> In the form we want to bind the firstName box, lastName box etc to
> >> corresponding fields in the objects for eacht costomer. If we use the
> normal
> >> for loop only the last customer is passed the others are lost.
> >> We cannot find an exammple of how to solve this problem. In the for
> loop
> >> documentation the IprimaryKeyConverter is mentioned, but We cannot
> figure
> >> out how to implement this properly.
> >> Can someone help us with an example or advise?
> >>
> >>
> >> Thanks a lot in advance!
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
>
> Met vriendelijke groet,
>
> Paul Voors
>
> function: Java Web Developer
> department: Webdevelopment
> Company:
> ATP - The Advanced Travel Partner
> Beechavenue 101 | 1119 RB Schiphol-Rijk | The Netherlands
> P.O. Box 75672 | 1118 ZS  Schiphol-Rijk | The Netherlands
> T +31 20 2011363 | F +31 20 2011362
> e-mail: paul@atp.nl
> www: www.atp.nl
>
>
>
> ---------------------------------------------------------------------
> 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: Re(2): Multiple objects in a form

Posted by "Gentry, Michael (Contractor)" <mi...@fanniemae.com>.
I was just discussing this on the Cayenne list last week.  I chose to
get the hash code of the object (customer) and return it to the
keyExpression.  I figured that was probably unique enough for my uses
(unlikely to have clashes over a small set of objects).  Also, this
would work for new/uncommitted objects (no primary key) as well as
persisted ones.  Seems to work OK in my preliminary tests.

HTH,

/dev/mrg


-----Original Message-----
From: Voors Paul [mailto:paul@atp.nl] 
Sent: Monday, June 26, 2006 10:18 AM
To: Tapestry users
Subject: Re(2): Multiple objects in a form


Peter,

Thanks for the fast reply.

I have an additional question, if you don't mind:

keyExpression="id"
I presume that the "id" in keyExpression is the (customer)id in the
(Customer)object.
Will this work when  i render new / empty objects?

Paul

Peter Svensson (06/26/2006 16:14):
>In the For component, it is possible to specifiy a "value" parameter,
which
>will hold the current object for every pass of the for loop. If we take
the
>example from the tapestry page and shorten it a bit;
>
><tr jwcid="@For" source="ognl:customerList" keyExpression="id"
>      value="ognl:customer" element="tr">
>    <td><span jwcid="@TextField" value="ognl:customer.fullName"/></td>
></tr>
>
>
>Then if you have ten customers in customerList, there will be ten
textFields
>shown, and each of those TextFields will call getFullName() on the
specific
>customer object when it renders, and call the setFullName(String foo)
method
>on the specific customer object when updated. IIRC.
>
>Cheers,
>PS
>
>
>On 26 Jun 2006 15:51:00 +0200, Voors Paul <pa...@atp.nl> wrote:
>>
>> Hello All,
>>
>> We have a page with a form were we ask the customer standard
information
>> about name an address etc.
>> We ask the information for multiple customers an for each customer we
use
>> a seperate object.
>> In the form we want to bind the firstName box, lastName box etc to
>> corresponding fields in the objects for eacht costomer. If we use the
normal
>> for loop only the last customer is passed the others are lost.
>> We cannot find an exammple of how to solve this problem. In the for
loop
>> documentation the IprimaryKeyConverter is mentioned, but We cannot
figure
>> out how to implement this properly.
>> Can someone help us with an example or advise?
>>
>>
>> Thanks a lot in advance!
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>

Met vriendelijke groet,

Paul Voors

function: Java Web Developer
department: Webdevelopment
Company:
ATP - The Advanced Travel Partner
Beechavenue 101 | 1119 RB Schiphol-Rijk | The Netherlands
P.O. Box 75672 | 1118 ZS  Schiphol-Rijk | The Netherlands
T +31 20 2011363 | F +31 20 2011362
e-mail: paul@atp.nl
www: www.atp.nl



---------------------------------------------------------------------
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(2): Multiple objects in a form

Posted by Voors Paul <pa...@atp.nl>.
Peter,

Thanks for the fast reply.

I have an additional question, if you don't mind:

keyExpression="id"
I presume that the "id" in keyExpression is the (customer)id in the (Customer)object.
Will this work when  i render new / empty objects?

Paul

Peter Svensson (06/26/2006 16:14):
>In the For component, it is possible to specifiy a "value" parameter, which
>will hold the current object for every pass of the for loop. If we take the
>example from the tapestry page and shorten it a bit;
>
><tr jwcid="@For" source="ognl:customerList" keyExpression="id"
>      value="ognl:customer" element="tr">
>    <td><span jwcid="@TextField" value="ognl:customer.fullName"/></td>
></tr>
>
>
>Then if you have ten customers in customerList, there will be ten textFields
>shown, and each of those TextFields will call getFullName() on the specific
>customer object when it renders, and call the setFullName(String foo) method
>on the specific customer object when updated. IIRC.
>
>Cheers,
>PS
>
>
>On 26 Jun 2006 15:51:00 +0200, Voors Paul <pa...@atp.nl> wrote:
>>
>> Hello All,
>>
>> We have a page with a form were we ask the customer standard information
>> about name an address etc.
>> We ask the information for multiple customers an for each customer we use
>> a seperate object.
>> In the form we want to bind the firstName box, lastName box etc to
>> corresponding fields in the objects for eacht costomer. If we use the normal
>> for loop only the last customer is passed the others are lost.
>> We cannot find an exammple of how to solve this problem. In the for loop
>> documentation the IprimaryKeyConverter is mentioned, but We cannot figure
>> out how to implement this properly.
>> Can someone help us with an example or advise?
>>
>>
>> Thanks a lot in advance!
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>

Met vriendelijke groet,

Paul Voors

function: Java Web Developer
department: Webdevelopment
Company:
ATP - The Advanced Travel Partner
Beechavenue 101 | 1119 RB Schiphol-Rijk | The Netherlands
P.O. Box 75672 | 1118 ZS  Schiphol-Rijk | The Netherlands
T +31 20 2011363 | F +31 20 2011362
e-mail: paul@atp.nl
www: www.atp.nl



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


Re: Multiple objects in a form

Posted by Peter Svensson <ps...@gmail.com>.
In the For component, it is possible to specifiy a "value" parameter, which
will hold the current object for every pass of the for loop. If we take the
example from the tapestry page and shorten it a bit;

<tr jwcid="@For" source="ognl:customerList" keyExpression="id"
      value="ognl:customer" element="tr">
    <td><span jwcid="@TextField" value="ognl:customer.fullName"/></td>
</tr>


Then if you have ten customers in customerList, there will be ten textFields
shown, and each of those TextFields will call getFullName() on the specific
customer object when it renders, and call the setFullName(String foo) method
on the specific customer object when updated. IIRC.

Cheers,
PS


On 26 Jun 2006 15:51:00 +0200, Voors Paul <pa...@atp.nl> wrote:
>
> Hello All,
>
> We have a page with a form were we ask the customer standard information
> about name an address etc.
> We ask the information for multiple customers an for each customer we use
> a seperate object.
> In the form we want to bind the firstName box, lastName box etc to
> corresponding fields in the objects for eacht costomer. If we use the normal
> for loop only the last customer is passed the others are lost.
> We cannot find an exammple of how to solve this problem. In the for loop
> documentation the IprimaryKeyConverter is mentioned, but We cannot figure
> out how to implement this properly.
> Can someone help us with an example or advise?
>
>
> Thanks a lot in advance!
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>