How to bind a collection of custom objects in WebFlow 2.2.1
I am trying to bind a collection of objects in a spring web flow form. Each object in the collection has fields that require a custom type converter.
Can this be done? How do I configure this?
Here is the basic idea of the code so far:
Code:
<view-state id="refund" view="refundAction" model="refundModel">
<var name="refundModel" class="xxxx.RefundModel" />
<binder>
<binding property="refunds" />
</binder>
...
</view-state>
public class RefundModel implements Serializable{
private List<RefundDTO> refunds;
public RefundModel(){
refunds = ListUtils.lazyList(new ArrayList<RefundDTO>(), FactoryUtils.instantiateFactory(RefundDTO.class));
}
public List<RefundDTO> getRefunds() {
return refunds;
}
public void setRefunds(List<RefundDTO> refunds) {
this.refunds = refunds;
}
}
public class RefundDTO implements Serializable{
//requires a custom converter
private SoTransactionDO payment;
//requires a custom converter
private Money amount;
private String address1;
private String address2;
private String city;
private String state_province;
private String zip_plus_4;
private String country;
//requires a custom converter
private Address userAddress;
//requires a custom converter
private Money maxAmount;
public RefundDTO(){}
}