2012-12-18 17 views
0

當我嘗試訪問我的應用程序(使用JSF,RichFaces,a4j框架)時出現以下錯誤。javax.faces.FacesException:javax.faces.FacesException:javax.el.PropertyNotFoundException:

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> 

回答

0

看來,contactList(從引用agentBean.personalDetails.contactList in datatable)包含一個空條目

因此下面的表達式無法計算

rendered="#{contact.visible}" 
+0

我已設置的默認值also.but靜止影像獲取error.Note:使用Tomcat6.x – Manu

+0

我不知道你的意思默認什麼IM值。您只需檢查通過personalDetails對象從託管bean返回的列表(contactList)不包含空條目。例如嘗試以下 '的 # {}接觸 將' 並檢查是否有任何列是空的(也就是說,接觸對象爲null) – dimcookies

+0

感謝enterlezi你是正確的「對象爲空」 .Could你告訴我如何修復它。「我試圖添加新的值,所以它將永遠是第一次空contactList(注意我試圖在我的機器上使用Tomcat 6.x本地運行代碼..same代碼工作在Unix環境下的WebSphere服務器中) – Manu