jsf - javax.faces.el.PropertyNotFoundException - Base is null: item -
i'm getting "base null: item" jsf1.1 error in datatable couldn't quite figure out. 2 level datatable , error happening on 2nd level datatable. first level datatable bind value of arraylist devicelistdevicereferences. in datatable, has column contains datatable. 2nd level datatable bind value of arraylist holdernamemasks. value retrived devicereferencejto, row item first datatable.
below snippet of html:
<h:datatable border="0" cellspacing="0" value="#{devicereferencebean.devicelistdevicereferences" var="item" rendered="#{not empty devicereferencebean.devicelistdevicereferences }" binding="#{devicereferencebean.devicelistdevicereferencestable}" > <h:column> <h:outputtext value="holder name:" /> <!-- device heading --> <h:outputtext value="#{item.devicelabel }" styleclass="devicereferencetitlebarborder" style="width:100%; height:30px; background-color:#f9f9f9"/> <!-- holder name --> <h:panelgrid columns="2" rendered="#{item.hasholdernamemasks}" > <h:outputtext value="holder name:" /> <h:datatable border="0" cellspacing="0" value="#{item.holdernamemasks}" var="holdermaskitem" rendered="#{not empty devicereferencebean.devicelistdevicereferences , item.hasholdernamemasks}" binding="#{item.holdernamemaskstable}" > <h:column> <h:outputtext value="#{holdermaskitem.fieldlabel}" /> </h:column> <h:column> <h:panelgrid columns="1"> <h:inputtext value="#{holdermaskitem.fieldvalue}" /> <h:outputtext value="#{holdermaskitem.instruction }" rendered="#{holdermaskitem.hasinstruction"/> </h:panelgrid> </h:column> </h:datatable> </h:panelgrid> </h:column> </h:datatable>
below component looks like:
<htmlform enctype="application/x-www-form-urlencoded" id="_idjsp323" rendered="true" styleclass="maform" submitted="false" transient="false"> <htmldatatable border="0" cellspacing="0" first="0" id="_idjsp324" rendered="#{not empty devicereferencebean.devicelistdevicereferences }=true" rowindex="-1" rows="0" transient="false" var="item" binding="#{devicereferencebean.devicelistdevicereferencestable}"> <uicolumn id="_idjsp325" rendered="true" transient="false"> <htmloutputtext escape="true" id="_idjsp326" rendered="true" style="width:100%; height:30px; background-color:#f9f9f9" styleclass="devicereferencetitlebarborder" transient="false"/> <htmlpanelgrid border="-2147483648" columns="2" id="_idjsp327" rendered="#{item.hasholdernamemasks}=true" transient="false"> <htmloutputtext escape="true" id="_idjsp328" rendered="true" transient="false" value="holder name:"/> </htmlpanelgrid> </uicolumn> </htmldatatable> </htmlform>
the culprit here:
<h:datatable binding="#{item.holdernamemaskstable}" >
the binding
(and id
) attributes of ui components resolved during view build time (that moment when jsf parses xhtml file component tree). however, #{item}
available during view render time (that moment when jsf encodes component tree html output). thus, there you're using binding="#{item.xxx}"
fail because #{item}
null
. note exception trying tell you.
you've 2 options:
- get rid of
binding
attribute altogether. - bind
#{devicereferencebean}
instead. it's available during view build time.
see also:
- jstl in jsf2 facelets... makes sense? - same answer applies here.
Comments
Post a Comment