ajax - PropertyNotFoundException when using bean's method's result for <h:selectBooleanCheckbox/> -


environment:

  • primefaces 5.1
  • mojarra 2.2.2
  • spring 4.0.2

current code:

i have following xhtml page:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"                 xmlns:ui="http://java.sun.com/jsf/facelets"                 xmlns:h="http://java.sun.com/jsf/html"                 xmlns:f="http://java.sun.com/jsf/core"                 xmlns:p="http://primefaces.org/ui"                 xmlns:c="http://java.sun.com/jsp/jstl/core"                 template="/web-inf/pages/main/admin.xhtml">      <ui:define name="contentbody">         <p:datatable widgetvar="weekdaytable"                      value="#{weekdaylist.countries}"                      var="ctr"                      styleclass="weekdaysmanagementdatatable">              <p:column width="100"                       sortby="#{ctr.desc}"                       headertext="#{msg['page.admin.weekday.list.country']}">                 <h:outputtext value="#{ctr.desc}" />             </p:column>              <c:foreach items="#{weekdaylist.weekdays}" var="day">                 <c:set var="open" value="#{weekdaylist.checkopen(ctr.id, day.date)}"/>                 <p:column width="20" headertext="#{utils.datetodayweek(day.date)}">                     <h:selectbooleancheckbox value="#{open}">                         <p:ajax listener="#{weekdaylist.handleday(ctr.id, day.id)}" />                     </h:selectbooleancheckbox>                 </p:column>             </c:foreach>         </p:datatable>     </ui:define> </ui:composition> 

the associated bean following :

@named("weekdaylist") @scope("session") public class adminweekdaylistcontroller implements serializable {      ...      public boolean checkopen(string ctrid, date date) {         country ctr = countrydao.getbyid(ctrid);         list<weekday> list = weekdaysmap.get(ctr);          if (list == null) {             return true;         }          weekday day = new weekday();         day.setdate(date);          (weekday wd : list) {             if (wd.compareto(day) == 0) {                 return wd.isopen();             }         }         return true;     } } 

i have bean maintains current page display , whole application made ajax. user on same page , content dynamically loaded.

the problem:

when reload (f5) page, seems work correctly. but, if go trought normal navigation (ajax loading), have got propertynotfoundexception...

here stack trace:

severe: javax.faces.component.updatemodelexception: javax.el.propertynotfoundexception: /web-inf/pages/main/admin/weekdaylist.xhtml @32,47 value="#{open}": /web-inf/pages/main/admin/weekdaylist.xhtml @29,74 value="#{weekdaylist.checkopen(ctr.id, day.date)}": property 'checkopen' not found on type stomac.web.controller.adminweekdaylistcontroller     @ javax.faces.component.uiinput.updatemodel(uiinput.java:867)     @ javax.faces.component.uiinput.processupdates(uiinput.java:749)     @ org.primefaces.component.api.uidata.process(uidata.java:342)     @ org.primefaces.component.api.uidata.processchildren(uidata.java:323)     @ org.primefaces.component.api.uidata.processphase(uidata.java:285)     @ org.primefaces.component.api.uidata.processupdates(uidata.java:271)     @ org.primefaces.component.datatable.datatable.processupdates(datatable.java:651)     @ javax.faces.component.uicomponentbase.processupdates(uicomponentbase.java:1286)     @ javax.faces.component.uicomponentbase.processupdates(uicomponentbase.java:1286)     @ javax.faces.component.uiform.processupdates(uiform.java:281)     @ javax.faces.component.uicomponentbase.processupdates(uicomponentbase.java:1286)     @ javax.faces.component.uicomponentbase.processupdates(uicomponentbase.java:1286)     @ javax.faces.component.uiviewroot.processupdates(uiviewroot.java:1254)     @ com.sun.faces.lifecycle.updatemodelvaluesphase.execute(updatemodelvaluesphase.java:78)     @ com.sun.faces.lifecycle.phase.dophase(phase.java:101)     @ com.sun.faces.lifecycle.lifecycleimpl.execute(lifecycleimpl.java:198)     @ javax.faces.webapp.facesservlet.service(facesservlet.java:646)     @ org.eclipse.jetty.servlet.servletholder.handle(servletholder.java:769)     @ org.eclipse.jetty.servlet.servlethandler.dohandle(servlethandler.java:585)     @ org.eclipse.jetty.server.handler.scopedhandler.handle(scopedhandler.java:143)     @ org.eclipse.jetty.security.securityhandler.handle(securityhandler.java:577)     @ org.eclipse.jetty.server.session.sessionhandler.dohandle(sessionhandler.java:223)     @ org.eclipse.jetty.server.handler.contexthandler.dohandle(contexthandler.java:1125)     @ org.eclipse.jetty.servlet.servlethandler.doscope(servlethandler.java:515)     @ org.eclipse.jetty.server.session.sessionhandler.doscope(sessionhandler.java:185)     @ org.eclipse.jetty.server.handler.contexthandler.doscope(contexthandler.java:1059)     @ org.eclipse.jetty.server.handler.scopedhandler.handle(scopedhandler.java:141)     @ org.eclipse.jetty.server.handler.contexthandlercollection.handle(contexthandlercollection.java:215)     @ org.eclipse.jetty.server.handler.handlercollection.handle(handlercollection.java:110)     @ org.eclipse.jetty.server.handler.handlerwrapper.handle(handlerwrapper.java:97)     @ org.eclipse.jetty.server.server.handle(server.java:497)     @ org.eclipse.jetty.server.httpchannel.handle(httpchannel.java:311)     @ org.eclipse.jetty.server.httpconnection.onfillable(httpconnection.java:248)     @ org.eclipse.jetty.io.abstractconnection$2.run(abstractconnection.java:540)     @ org.eclipse.jetty.util.thread.queuedthreadpool.runjob(queuedthreadpool.java:610)     @ org.eclipse.jetty.util.thread.queuedthreadpool$3.run(queuedthreadpool.java:539)     @ java.lang.thread.run(thread.java:745) caused by: javax.el.propertynotfoundexception: /web-inf/pages/main/admin/weekdaylist.xhtml @32,47 value="#{open}": /web-inf/pages/main/admin/weekdaylist.xhtml @29,74 value="#{weekdaylist.checkopen(ctr.id, day.date)}": property 'checkopen' not found on type stomac.web.controller.adminweekdaylistcontroller     @ com.sun.faces.facelets.el.tagvalueexpression.setvalue(tagvalueexpression.java:133)     @ javax.faces.component.uiinput.updatemodel(uiinput.java:832)     ... 36 more caused by: javax.el.propertynotfoundexception: /web-inf/pages/main/admin/weekdaylist.xhtml @29,74 value="#{weekdaylist.checkopen(ctr.id, day.date)}": property 'checkopen' not found on type stomac.web.controller.adminweekdaylistcontroller     @ com.sun.faces.facelets.el.tagvalueexpression.setvalue(tagvalueexpression.java:133)     @ org.apache.el.parser.astidentifier.setvalue(astidentifier.java:129)     @ org.apache.el.valueexpressionimpl.setvalue(valueexpressionimpl.java:260)     @ com.sun.faces.facelets.el.tagvalueexpression.setvalue(tagvalueexpression.java:131)     ... 37 more caused by: javax.el.propertynotfoundexception: property 'checkopen' not found on type stomac.web.controller.adminweekdaylistcontroller     @ javax.el.beanelresolver$beanproperties.get(beanelresolver.java:245)     @ javax.el.beanelresolver$beanproperties.access$300(beanelresolver.java:222)     @ javax.el.beanelresolver.property(beanelresolver.java:332)     @ javax.el.beanelresolver.gettype(beanelresolver.java:82)     @ com.sun.faces.el.demuxcompositeelresolver._gettype(demuxcompositeelresolver.java:215)     @ com.sun.faces.el.demuxcompositeelresolver.gettype(demuxcompositeelresolver.java:242)     @ org.apache.el.parser.astvalue.setvalue(astvalue.java:199)     @ org.apache.el.valueexpressionimpl.setvalue(valueexpressionimpl.java:260)     @ com.sun.faces.facelets.el.tagvalueexpression.setvalue(tagvalueexpression.java:131)     ... 40 more 

but make me think problem not come bean is, if remove #{open} value of <h:selectbooleancheckbox/> works (except checkboxes not checked way want):

<c:foreach items="#{weekdaylist.weekdays}" var="day">     <c:set var="open" value="#{weekdaylist.checkopen(ctr.id, day.date)}"/>     <p:column width="20" headertext="#{utils.datetodayweek(day.date)}">         #{open}         <h:selectbooleancheckbox value="true">             <p:ajax listener="#{weekdaylist.handleday(ctr.id, day.id)}" />         </h:selectbooleancheckbox>     </p:column> </c:foreach> 

as can see keep using #{open} not inside value attibute.

questions:

what did wrong? missing something? there bug?

thanks.

so... have found "solution", , respond own question.

i added fakes getter , setter method checkopen. bean looks this:

@named("weekdaylist") @scope("session") public class adminweekdaylistcontroller implements serializable {      ...      public boolean getcheckopen() {         return true;     }      public void setcheckopen(boolean b) {     }      public boolean checkopen(string ctrid, date date) {         country ctr = countrydao.getbyid(ctrid);         list<weekday> list = weekdaysmap.get(ctr);          if (list == null) {             return true;         }          weekday day = new weekday();         day.setdate(date);          (weekday wd : list) {             if (wd.compareto(day) == 0) {                 return wd.isopen();             }         }         return true;     } } 

this way jsf thinks checkopen valid (read/write) attribute, but calls checkopen(string ctrid, date date). never calls getter or setter...

if can explain this, gratefull. , if has better solution, listening.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -