Dear,
I'm facing a little problem.
I have a bean "Report" which has a Set<LinkReportProduct> called "linkReportProducts" .
Here is the structure of a LinkReportProduct :
The referenceData method of my Controller initialize a list of products.Code:public class LinkReportProduct implements java.io.Serializable { private long lrepprodId; private Report report; private Product product; ..}
Part of my Jsp :
My checkboxes are displayed correctly, when i push submit, the Set<LinkReportProduct> linkReportProducts is correctly populated using this method in the initBinder :Code:Produits concernés : <form:checkboxes items="${prodList}" path="linkReportProducts" itemLabel="prodName" itemValue="prodId"/>
Everything looks fine, excepted that when i come back to my jsp, the previously choosen values are not selected.Code:binder.registerCustomEditor(Set.class, "linkReportProducts",new CustomCollectionEditor(Set.class){ @Override protected Object convertElement(Object element){ long id=NumberUtils.parseNumber((String)element,Long.class).longValue(); prodManager.loadClass(Product.class); Product prod = prodManager.getObjById(id); // Not really needed to load products from the DB, but whatever.. Not the problem I guess :) LinkReportProduct lreprod = new LinkReportProduct(); lreprod.setProduct(prod); lreprod.setReport(rap); return lreprod; } });
Neither the equals method of Product nor the equals method of LinkReportProduct are called.
It works for every other fields (input text, select, .., but not multiple values)
Could you tell me what am I doing wrong ?
Thanks.


Reply With Quote
