Encoder with <t: loop> component in Tapestry
I have one page that displays the details of some client. I use t:loopto display some data. As t:loopI just pass sourceand value. So far so good, my page is working fine. But when I try to submit a page, it suddenly gives me an Exception.
"Could not find coercion of type java.lang.String for input [addressUsageValue] Available coercion: .........."
Below is a sample code
<t:loop source="addressUsageInfo" value="addressUsageValue">
<tr>
<td>${addressUsageValue?.usage}</td>
<td>${addressUsageValue?.address}</td>
<td>${addressUsageValue?.postCode}</td>
<td>${addressUsageValue?.city}</td>
<td>${addressUsageValue?.country}</td>
</tr>
</t:loop>
I studied a little and found the links below.
http://tapestry.apache.org/5.3.3/apidocs/org/apache/tapestry5/corelib/components/Loop.html https://issues.apache.org/jira/browse/TAP5-609
, Loop. . toClient() toValue() 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;
}
};
, .
- , ? ,
- Encoder - . , toValue() toClient() ?
- - , Encoder??
+5
2
Henning . null . , . . Boolean . -. '' onClick . - ( ) . formstate = "", .
<t:loop t:source="treeNodeList" value="treeNode"
t:encoder="treeNodeEncoder" formState="iteration">
<tr style="text-align:center;">
<td class="table-checkbox" id="data-table-1st-col">
<input t:type="checkbox" value="currentSelectedTreeNode"
onclick="this.form.submit();"/>
....
</td>
</tr>
</t:loop>
+1