tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Athneria, Mahendra" <mahendra.athne...@atos.net>
Subject Encoder with <t:loop>
Date Fri, 22 Jun 2012 05:30:12 GMT

I have one Page which is displaying details of some Client. I am using t:loop to display some
data. In t: loop I am just passing source and value. So far so good, my page is working fine.
But when I try to submit the Page it suddenly give me the Exception.

"Could not find a coercion from type java.lang.String to type [addressUsageValue] Available

Below is the sample code

<t:loop source="addressUsageInfo" value="addressUsageValue">

I did some goggling and find below references.


So I have created encoder for Loop. Below is the sample code. In below toClient() method I
have randomly returned any value and in toValue() method I am returning null.

      private final ValueEncoder<DtoAddressUsageInfo> addressUssageEncoder = new ValueEncoder<DtoAddressUsageInfo>()

            public String toClient(DtoAddressUsageInfo value) {
                  return String.valueOf(value.getUsage());

            public DtoAddressUsageInfo toValue(String clientValue) {
                  return null;

Now my code is working fine and I am able to submit the form.

Here my doubt comes

First - I am not able to understand why encoder is required when using loop?? And if it is
required to submit the form then why it is not Mandatory parameter??

Second - I have just implemented the Encoder without any logic. I am not able to understand
where toValue() and toClient() method is used and what is the purpose?

Third - when I submit the Page why form required Encoder??

Mahendra Athneria
Ext-+91 22 6733 3729
Mob-+91 9833 121 309

  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message