0

我正在使用素面。当我单击查看按钮时,发生以下异常找不到从“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.
4

1 回答 1

1

您 outputLabel 正在寻找一个 id=company 的组件,但没有:

<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" 重命名为 id="company"

于 2013-09-24T07:29:24.720 回答