2013-02-28 15 views
1

您好我需要創建一個帶有tab1內的數據表的手風琴面板,但我將geeting以下錯誤:: javax.Servlet.ServletException:can not找到標識符爲「:form:display」的組件,任何人都可以幫助我解決這個錯誤使用primefaces.i需要工作,而不使用小部件。javax.Servlet.ServletException:無法找到具有標識符「:form:display」的組件:

view.xhtml

<h:form prependId="false" id="form"> 

<p:dataTable id="dataTable" var="car" value="#{tableBean.getList()}" 
      paginator="true" rows="10" selectionMode="single" selection="#{tableBean.selectedCar}" rowKey="#{car.model}" 
      paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
      rowsPerPageTemplate="5,10,15"> 
    <f:facet name="header"> 
     Posted Jobs 
    </f:facet> 

    <p:column> 
     <f:facet name="header"> 
      <h:outputText value="Model" /> 
     </f:facet> 
     <h:outputText value="#{car.model}" /> 
    </p:column> 

    <p:column> 
     <f:facet name="header"> 
      <h:outputText value="Year" /> 
     </f:facet> 
     <h:outputText value="#{car.year}" /> 
    </p:column> 

    <p:column> 
     <f:facet name="header"> 
      <h:outputText value="Manufacturer" /> 
     </f:facet> 
     <h:outputText value="#{car.manufacturer}" /> 
    </p:column> 

    <p:column> 
     <f:facet name="header"> 
      <h:outputText value="Color" /> 
     </f:facet> 
     <h:outputText value="#{car.color}" /> 
    </p:column> 
     <f:facet name="footer"> 
     <p:commandButton id="viewButton" value="View" icon="ui-icon-search" 
       update=":form:display" oncomplete="carDialog.show()" actionListener="#{tableBean.add}" 
       /> 
    </f:facet> 

</p:dataTable> 
<p:dialog id="dialog" header="Car Detail" widgetVar="carDialog" resizable="false" 
      width="200" showEffect="clip" hideEffect="fold"> 

    <h:panelGrid id="display" columns="2" cellpadding="4"> 



     <h:outputText value="Model:" /> 
     <h:outputText value="#{tableBean.selectedCar.model}" /> 

     <h:outputText value="Year:" /> 
     <h:outputText value="#{tableBean.selectedCar.year}" /> 

     <h:outputText value="Manufacturer:" /> 
     <h:outputText value="#{tableBean.selectedCar.manufacturer}" /> 

     <h:outputText value="Color:" /> 
     <h:outputText value="#{tableBean.selectedCar.color}" /> 
    </h:panelGrid> 
</p:dialog> 

    </h:form> 

AccordionPanel.xhtml

<h:head> 
    <title>Accordion Panel</title> 
</h:head> 
<h:body> 

    <h:form> 
     <p:accordionPanel> 
<p:tab id="DataTable1" title="DataTable 1"> 
<ui:include src="view.xhtml" /> 
    </p:tab> 
    <p:tab id="DataTable2" title="DataTable2"> 
</p:tab> 
</p:accordionPanel> 
    </h:form> 

</h:body> 
</html> 
+0

你能移動表單外的'dialog'並嘗試使用'update =:display'? – 2013-02-28 08:20:26

+0

嗨view.xhtml將正常工作,但得到錯誤javax.faces.FacesException - 如果我刪除更新=「:形式:顯示」它不會給出選定的行內容中找不到具有標識符「:顯示」的組件在運行AccordionPanel – Vidya 2013-03-01 07:55:30

回答

3

您收到此錯誤,因爲你的命令按鈕更新目標無法使用指定的組件引用中找到呈現的HTML。

<p:commandButton id="viewButton" value="View" icon="ui-icon-search" 
update=":form:display" oncomplete="carDialog.show()" actionListener="#tableBean.add}"/> 

嘗試取出update=":form:display",使你的頁面可以渲染,請與螢火蟲顯示panelGrid中的生成組件ID,並使用該ID在你更新的目標。

由於primefaces版本3.1組件引用與JSF規範對齊。請參閱此鏈接瞭解更多信息UI Component findComponent()

+0

在對話框中,只有標題值將顯示在對話框 – Vidya 2013-02-28 10:27:28

+0

中,您將臨時刪除它以查看您的panelgrid的組件ID(您想要更新的組件ID),然後將其替換爲:form:display with。 – 2013-02-28 11:07:58

1

更新你的(更新=「:形式:顯示」)上的commandButton屬性是:

更新=「:形式:對話框:顯示」

+0

嗨我也試過,如果我這樣做,它會給出以下錯誤:java.lang.IllegalArgumentException - 搜索表達式對話框中的中間標識符對話框:顯示標識不是NamingContainer的UIComponent – Vidya 2013-03-01 07:42:27