javax.faces.FacesException:javax.faces.FacesException:javax.el.PropertyNotFoundException:

时间:2012-12-18 14:14:03

标签: richfaces ajax4jsf propertynotfoundexception

当我尝试访问我的应用程序时(使用JSF,RichFaces,a4j框架),我收到以下错误。

SEVERE: Error Rendering View[/index.xhtml]
javax.faces.FacesException: javax.faces.FacesException: javax.el.PropertyNotFoundException: /facelets/home.xhtml @448,82 rendered="#{contact.visible}": ELResolver cannot handle a null base Object with identifier 'contact'
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:672)
at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:680)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:678)
at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:680)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:678)
at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:680)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:678)
at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:680)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:678)
at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:680)
at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:543)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:883)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:578)
at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99)
at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)

下面是'home.xhtml'页面

     <h:dataTable id="contactsTable"
 value="#{agentBean.personalDetails.contactList}"
      var="contact" border="0" width="90%">
     <h:column>
     <a4j:region id="ContactTypeRegion">
     <h:selectOneMenu id="contactType"
     value="#{contact.contactType}"
required="#{param['contactValidation'] != '0'}"
requiredMessage="#{user.ContactTypeRequired}">
<f:selectItems
value="#{contact.contactTypeList}" />
<a4j:support event="onchange"
focus="contactCode"
action="#{contact.enableContactNumber}"
reRender="ContactCodePanel,ContactNumPanel,EntensionPanel" />
</h:selectOneMenu>
</a4j:region>
<a4j:outputPanel id="ContactCodePanel">
<rich:spacer height="1" width="2" />
<h:inputText id="contactCode"
label="Contact Code"
value="#{contact.contactCountryCode}"
style="width:10%" class="txtBox"
required="#{param['contactValidation'] != '0'}"
requiredMessage="#{user.ContactCodeRequired}"
maxlength="3">
<f:validator
validatorId="NumericValidator" />
<f:validateLength minimum="3" maximum="3" />
<rich:toolTip for="ContactCodePanel"
value="Area Code" direction="bottom-left"
styleClass="tooltip" />
<rich:ajaxValidator event="onblur" />
</h:inputText>
                                        <rich:spacer height="1" width="2" />
<h:outputText value="-" />
</a4j:outputPanel>
<rich:spacer height="1" width="2" />

以下是获得上述错误的重点

<a4j:commandLink id="removeContact1"
value="#{contact.remove}"
rendered="#{contact.visible}"
reRender="contactsTable"
action="#{agentBean.personalDetails.removeContact}">
<a4j:actionparam name="contactValidation"
value="0" />
</a4j:commandLink>
</h:column>
</h:dataTable>

1 个答案:

答案 0 :(得分:0)

似乎 contactList (从datatable中的 agentBean.personalDetails.contactList 引用)包含空条目

因此无法评估以下表达式

rendered="#{contact.visible}"