2012-11-23 67 views
3

我無法以其他形式更新datatable我無法以其他形式更新數據表

javax.servlet.ServletException: Cannot find component with identifier "searchForm:dataTableId" referenced from "criteriaForm:j_idt13". 
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:321) 
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129) 
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77) 
    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113) 
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 

我創建了兩種表格,但我無法更新bean。 我正在使用;

<h:form id="criteriaForm"> 
     <p:panel> 
      <h:panelGrid columns="3" cellpadding="2"> 
       <h:panelGrid columns="3" cellpadding="2"> 
        <h:outputText value=start"></h:outputText> 
        <p:calendar required="false" id="date1" 
         value="#{searchBean.date1}"> 
         <f:convertDateTime locale="en" pattern="dd/MM/yyyy" /> 
        </p:calendar> 
       </h:panelGrid> 
       <h:panelGrid columns="3" cellpadding="2"> 
        <h:outputText value="end"></h:outputText> 
        <p:calendar locale="en" required="false" id="date2" 
         value="#{searchBean.date2}"> 
         <f:convertDateTime locale="en" pattern="dd/MM/yyyy" /> 
        </p:calendar> 
       </h:panelGrid> 
       <p:commandButton icon="ui-icon-search" value="Search" type="submit" 
        actionListener="#{searchBean.commit()}" 
        style="width:110px;" update="searchForm:dataTableId"></p:commandButton> 
      </h:panelGrid> 
     </p:panel> 
    </h:form> 
    <br /> 
    <h:form id="searchForm"> 
     <p:dataTable var="item" id="dataTableId" widgetVar="dataTableWidget" 
      paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
      rowIndexVar="index" value="#{searchBean.lazyModel}" 
      lazy="true" paginator="true" resizableColumns="false" rows="15"> 
      <p:column headerText="TEST"> 
       <h:outputText value="#{item.customerName}"></h:outputText> 
      </p:column> 
      <p:column headerText="TEST"> 
       <h:outputText value="#{item.customerCode}"></h:outputText> 
      </p:column> 
      <p:column headerText="TEST"> 
       <h:outputText value="#{item.customerPhone}"></h:outputText> 
      </p:column> 
     </p:dataTable> 
    </h:form> 

我從該頁面的源代碼複製 「searchForm:dataTableId

回答

1

您需要在絕對客戶端ID前加上命名容器分隔符字符,在您的情況下爲:。所以,你應該使用update=":searchForm:dataTableId"來代替。

<p:commandButton icon="ui-icon-search" value="Search" type="submit" 
    actionListener="#{searchBean.commit()}" 
    style="width:110px;" update=":searchForm:dataTableId"> 
</p:commandButton> 

否則將被搜索相對於當前命名容器組件,它是第一<h:form>本身。