1

Hi i need to create a accordian panel with a datatable inside the tab1 but i am geeting the following error:: javax.Servlet.ServletException:cannot find component with identifier ":form:display" ,can anyone plz help me out to resolve this error using primefaces.i need to work without using widgets.

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>
Vidya
  • 51
  • 2
  • 9
  • Can you move the `dialog` outside the form and try to use `update=:display`? – Dominik Sandjaja Feb 28 '13 at 08:20
  • hi view.xhtml will be working fine but getting the error javax.faces.FacesException - Cannot find component with identifier ":display" while running AccordionPanel – Vidya Mar 01 '13 at 07:55

2 Answers2

3

You are getting this error because the update target of your commandButton can not be found using the specified component reference on the rendered html.

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

Try removing the update=":form:display" so that your page can render, check the generated component id of the display panelGrid with Firebug and use that id in your update target.

Since primefaces version 3.1 component referencing is aligned with the JSF Spec. See this link for further information UI Component findComponent()

Can Yegane
  • 514
  • 4
  • 11
  • if i removed update=":form:display" it wont gives selected row contents in the dialog box,only header values will be displayed in the dialogbox – Vidya Feb 28 '13 at 10:27
  • you are going to temporarily remove it to see what the component id of your panelgrid is (the one that you want to update), then replace :form:display with that. – Can Yegane Feb 28 '13 at 11:07
1

update your (update=":form:display") attribute on commandButton to this :

update=":form:dialog:display"

Mohamed AbdElRazek
  • 1,654
  • 14
  • 17
  • hi i tried that one also,if i do so it will give the following error : java.lang.IllegalArgumentException - Intermediate identifier dialog in search expression dialog:display identifies a UIComponent that is not a NamingContainer – Vidya Mar 01 '13 at 07:42