2013-09-24 41 views
0

我正在使用primefaces。當我點擊查看按鈕時發生以下異常 無法找到標識爲」company「的組件,其格式爲」form1:j_idt78「。 哪裏是錯誤,我可以找到請幫助我。 由於事先找不到具有標識符「company」的組件,其引用來自「form1:j_idt78

XHTML文件是

<h:form dir="#{localeControllerBean.direction}"> 

          <p:panel header="#{msg['list_category']}" id="empDetails" 
        style="font-size:small;height:593px;width:100%; background: -webkit-gradient(linear, left top, left bottom, color-stop(1%,#a7b5c6), color-stop(100%,#f2f7f7)); /* Chrome,Safari4+ */ 
background: -webkit-linear-gradient(top, #a7b5c6 1%,#f2f7f7 100%); /* Chrome10+,Safari5.1+ */ 
background: -o-linear-gradient(top, #a7b5c6 1%,#f2f7f7 100%); /* Opera 11.10+ */ 
background: -ms-linear-gradient(top, #a7b5c6 1%,#f2f7f7 100%); /* IE10+ */ 
background: linear-gradient(to bottom, #a7b5c6 1%,#f2f7f7 100%);"> 

          <p:growl id="msgs" autoUpdate="true" display="icon"></p:growl> 
          <f:event listener="#{localeControllerBean.islang}" type="preRenderView" /> 
          <p:dataTable id="dt1" var="cat" value="#{cateagoryBean.categorynames}" 
           rowKey="#{cat.category_id}" 
           selection="#{cateagoryBean.category}" 
           resizableColumns="true" selectionMode="single" paginator="true" 
           rows="10" 
           paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
           rowsPerPageTemplate="5,10" 
           style="width:99%; margin-left: 10px; margin-top:5px; top:10px;"> 
           <f:facet name="header"> 
           #{msg['list_category']} 
           </f:facet> 
           <p:column> 
            <f:facet name="header"> 
            #{msg['category_name']} 
            </f:facet> 
            <h:outputText value="#{cat.category_name}" /> 
           </p:column> 
           <p:column> 
            <f:facet name="header"> 
            #{msg['type']} 
            </f:facet> 
            <h:outputText value="#{cat.typeName}" /> 
           </p:column> 
           <p:column> 
            <f:facet name="header"> 
           #{msg['status']} 
            </f:facet> 
            <h:outputText value="#{cat.status}" /> 
           </p:column> 




           <f:facet name="footer"> 
            <p:commandButton id="viewCommand" value="#{msg['view']}" 
             icon="ui-icon-search" 
             action="#{cateagoryBean.viewcat(cateagoryBean.category)}" ajax="false" /> 
           </f:facet> 
           <f:facet name="footer"> 
            <p:commandButton id="updateCommand" type="submit" 
             value="#{msg['update']}" icon="ui-icon-arrowrefresh-1-w" 
             action="#{cateagoryBean.editcat(cateagoryBean.category)}" 
             ajax="false" /> 
           </f:facet> 
           <f:facet name="footer"> 
            <p:commandButton id="deleteCommand" type="submit" 
             value="#{msg['delete']}" icon="ui-icon-close" 
             action="#{cateagoryBean.deletecategory(cateagoryBean.category)}" 
             ajax="false" /> 
           </f:facet> 

          </p:dataTable> 
          </p:panel> 
         </h:form> 

下一個XHTML頁面

<h:form enctype="multipart/form-data" dir="#{localeControllerBean.direction}" id="form1"> 
       <div id="add"> 
       <p:growl id="msgs" autoUpdate="true" display="icon" style="left:20px"></p:growl> 

       </div> 
       <p:panel header="#{msg['categorydetail']}" style="font-size:small"> 
        <h:panelGrid columns="2"> 
         <p:outputLabel for="cname" value="#{msg['category_name']}" 
          styleClass="label" /> 
         <h:outputText id="cname" value="#{cateagoryBean.category.category_name}" 
          required="true" requiredMessage="Please Enter Category Name" 
          styleClass="input"/> 


         <p:outputLabel for="description" value="#{msg['description']}" 
          styleClass="label" /> 
         <h:outputText id="description" value="#{cateagoryBean.category.description}" 
          required="true" requiredMessage="Please enter sponsor address" 
          styleClass="input" /> 
         <h:outputLabel for="selectType" value="#{msg['type']}"/> 
         <h:outputText id="selectType" value="#{cateagoryBean.category.typeName}" 
          required="true" requiredMessage="Please enter sponsor address" 
          styleClass="input" /> 


         <p:outputLabel for="company" value="#{msg['emp_selectcompany']}" styleClass="label"/> 
         <h:outputText id="selectType" value="#{cateagoryBean.category.tbl_company.comapnyname}" 
          required="true" requiredMessage="Please enter sponsor address" 
          styleClass="input" /> 


        </h:panelGrid> 

            </p:panel> 
      </h:form> 


please tell me where is error. 
+0

錯誤出現在此頁面中。在下一頁什麼'#{cateagoryBean.viewcat(cateagoryBean.category)}'動作按鈕返回。您可以使用下一頁 – kark

+0

id =「company」而不是「selectType」 – user249766

回答

1

您outputLabel正在尋找與ID =公司的組成部分,但也沒有了:

<p:outputLabel for="company" value="#{msg['emp_selectcompany']}" styleClass="label"/> 
<h:outputText id="selectType" value="#{cateagoryBean.category.tbl_company.comapnyname}" 
required="true" requiredMessage="Please enter sponsor address" 
styleClass="input" /> 

您應該重命名outputText的id從h:outputText id =「 selectType「to id =」company「

+0

YES!有效。太簡單了!非常感謝你。 – user249766