PropertyNotFoundException
zogehu Jun 6, 2010 12:25 PMI am developing a page with dataTable and subTable, and I 've got an excpetion and I don't how to avoid it:
javax.el.PropertyNotFoundException: /nhIngAlbTulFolyUj.xhtml @53,79 value="#{_tulfolyHonap.total}": Property 'total' not readable on type java.lang.Integer
JBoss 4.2.3 Seam 2.1.1
If I change
"#{_tulfoly.total}" to "#{_tulfoly}" the table and subtable works, but I is not good for me!
<h:form id="dataActionForm1"> <h:commandButton id="dataAction" value="dataAction" action="#{tulfolyAction.lekerdez}" /> </h:form> <rich:dataTable value="#{tulfolyAction.tulfolys}" var="_tulfoly" > <rich:columnGroup> <rich:column colspan="2"> <h:outputText value="#{_tulfoly.total}" /> </rich:column> </rich:columnGroup> <rich:subTable value="#{_tulfoly.tulfolyHonaps}" var="_tulfolyHonap" > <rich:column> <h:outputText value="#{_tulfolyHonap.total}"/> </rich:column> </rich:subTable> </rich:dataTable>
Action code:
/** * */ @Name("tulfolyAction") @Scope(ScopeType.SESSION) public class TulfolyAction { @Logger private Log log; private List<Tulfoly> tulfolys = new ArrayList<Tulfoly>(); private Integer total; public void lekerdez(){ setTulfolys(new ArrayList<Tulfoly>()); log.info("tulfolyAction lekerdezes"); Tulfoly tf = new Tulfoly(); TulfolyHonap th = new TulfolyHonap(); TulfolyHonap th2 = new TulfolyHonap(); TulfolyBevet tb = new TulfolyBevet(); tb.setDatum(new Date(System.currentTimeMillis())); tb.setId((Long) 1L); tb.setKod("kod"); tb.setJogcim("jogcim"); tb.setBefizetes((Integer) 15); tb.setKotelezettseg((Integer) 1255); th.setTotal((Integer)120); th2.setTotal(222); //th.getBevets().add(tb); List<TulfolyBevet> l = new ArrayList<TulfolyBevet>(); l.add(tb); th.setBevets(l); tf.getTulfolyHonaps().add(th); tf.getTulfolyHonaps().add(th2); tf.setTotal((Integer)123456); getTulfolys().add(tf); setTotal((Integer) 1555); log.info("bev:"+getTulfolys().get(0).getTulfolyHonaps().get(0).getBevets()); } /** * @return the tulfolys */ public List<Tulfoly> getTulfolys() { return tulfolys; } /** * @param tulfolys the tulfolys to set */ public void setTulfolys(List<Tulfoly> tulfolys) { this.tulfolys = tulfolys; } /** * @return the total */ public Integer getTotal() { return total; } /** * @param total the total to set */ public void setTotal(Integer total) { this.total = total; } }
public class Tulfoly { private List<TulfolyHonap> tulfolyHonaps = new ArrayList<TulfolyHonap>(); private Integer total; /** * @return the total */ public Integer getTotal() { return total; } /** * @param total the total to set */ public void setTotal(Integer total) { this.total = total; } @Override public String toString() { return "tulfoly total: "+total; } /** * @return the tulfolyHonaps */ public List<TulfolyHonap> getTulfolyHonaps() { return tulfolyHonaps; } /** * @param tulfolyHonaps the tulfolyHonaps to set */ public void setTulfolyHonaps(List<TulfolyHonap> tulfolyHonaps) { this.tulfolyHonaps = tulfolyHonaps; } }
class TulfolyHonap { private List<TulfolyBevet> bevets = new ArrayList<TulfolyBevet>(); private Integer total; private String szov; /** * @return the bevets */ public List<TulfolyBevet> getBevets() { System.out.println("getbevets:"+bevets); return bevets; } /** * @param bevets the bevets to set */ public void setBevets(List<TulfolyBevet> bevets) { this.bevets = bevets; } @Override public String toString() { return "tulfolyhonap total: "+total + " szov: "+szov; } /** * @return the total */ public Integer getTotal() { return total; } /** * @param total the total to set */ public void setTotal(Integer total) { this.total = total; } /** * @return the szov */ public String getSzov() { return szov; } /** * @param szov the szov to set */ public void setSzov(String szov) { this.szov = szov; } }