当我尝试使用<p:ajax update =“”>从另一个表单刷新表单组件时,它显示错误“无法找到组件

时间:2018-03-10 06:32:17

标签: jsf primefaces

任何人都可以帮助我解决问题吗?虽然我已经看到来自这个网站的semilar问题,但我无法解决我的问题。这是我的代码..

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device.width, initial-scale=1"/>
    <meta http-equiv="X-UA-Conpatible" content="IE=edge"/>
    <h:outputStylesheet library="css" name="bootstrap.css"/>
    <link href="resources/css/w3.css" rel="stylesheet" type="text/css"/>
    <link href="resources/css/w3-theme-teal.css" rel="stylesheet" type="text/css"/>    

    <div class="panel panel-info">
        <!-- Default panel contents -->
        <div class="panel-heading">Student Wise Fees Collection Details</div>            
        <div class="panel-body">                        
            <div class="row">                    
                <div class="col-lg-3 col-md-3 col-sm-3">
                    <div class="panel panel-info" >
                        <div class="panel-heading">Payment Details</div> 
                        <div class="panel-body">
                            <div class="col-lg-12 col-md-12 col-sm-12" style="padding-top: 4%">
                                <h:form id="form1">
                                    <div class="input-group input-group-lg input-group-sm" style="padding-bottom: 6%;">
                                        <span class="input-group-addon" id="sizing-addon1" style="color: blue;">Student Id:</span>                                                                                
                                        <p:inputText id="student_id" value="#{controllerBean.selectedfee.stuId}" type="text" readonly="true" style="width: 85%; color: blue;" class="form-control" placeholder="Student Id"/>                                                                                                 
                                    </div>
                                    <div class="input-group input-group-lg input-group-sm" style="padding-bottom: 6%;">
                                        <span class="input-group-addon" id="sizing-addon1">Name:</span>
                                        <p:inputText id="stname" type="text" readonly="true" value="#{controllerBean.selectedfee.name}" class="form-control" placeholder="Name of the student" />                                        
                                    </div>
                                    <div class="input-group input-group-lg input-group-sm" style="padding-bottom: 6%;">
                                        <span class="input-group-addon" id="sizing-addon1">Program:</span>
                                        <p:inputText id="pname" type="text" readonly="true" value="#{controllerBean.selectedfee.program}" class="form-control" placeholder="Program Name" />
                                    </div>
                                    <div class="input-group input-group-lg input-group-sm" style="padding-bottom: 6%;">
                                        <span class="input-group-addon" id="sizing-addon1">Session:</span>
                                        <p:inputText id="s_name" type="text" readonly="true" value="#{controllerBean.selectedfee.session}" class="form-control" placeholder="Session Name" />
                                    </div>  
                                    <div class="input-group input-group-lg input-group-sm" style="padding-bottom: 6%;">
                                        <span class="input-group-addon" id="sizing-addon1">Recept No:</span>
                                        <p:inputText id="recptno" type="text" value="#{controllerBean.selectedfee.recptNo}" readonly="true" class="form-control" placeholder="Recept Number" />                                        
                                    </div>
                                    <div class="input-group input-group-lg input-group-sm" style="padding-bottom: 6%;">
                                        <span class="input-group-addon" id="sizing-addon1">Amount:</span>
                                        <p:inputText id="a_mnt" type="text" value="#{controllerBean.selectedfee.amount}" readonly="true" class="form-control" placeholder="Paid Amount" />                                        
                                    </div>
                                    <div class="input-group input-group-lg input-group-sm" style="padding-bottom: 6%;">
                                        <span class="input-group-addon" id="sizing-addon1" style="color: green;">Voucher:</span>
                                        <p:inputText id="voucher" type="text" value="#{controllerBean.selectedfee.AIBLVoucher}" readonly="true" style="color: green;" class="form-control" placeholder="AIBL Voucher Number" />                                        
                                    </div>
                                    <div class="input-group input-group-lg input-group-sm" style="padding-bottom: 4%;">
                                        <span class="input-group-addon" id="sizing-addon1" style="color: red;">AUB Token:</span>
                                        <p:inputText id="aub_token" type="text" value="#{controllerBean.selectedfee.stud_pay_rec_mid}" style="color: red;" readonly="true" class="form-control" placeholder="AUB TXN ID Number" />                                        
                                    </div>
                                </h:form>
                            </div>                                        
                        </div>
                    </div>
                </div>
                <div class="col-lg-9 col-md-9 col-sm-9" >
                    <div class="col-lg-12 col-md-12 col-sm-12" >
                        <div class="panel panel-info">
                            <div class="panel-heading">Student's Payment Record</div>
                            <div class="panel-body">
                                <h:form id="form2">
                                    <input type="text" class="form-control" id="task-table-filter" data-action="filter" data-filters="#task-table" placeholder="Filter Tasks" />
                                    <p:dataTable class="table table-hover" value="#{controllerBean.listofunifees}" var="FEES_COLLECTION" selection="#{controllerBean.selectedfee}" id="task-table" rowKey="#{FEES_COLLECTION.stud_pay_rec_mid}" selectionMode="single" paginator="true" paginatorPosition="bottom" rows="7"  paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" >
                                        <p:ajax event="rowSelect" update=":form1" />                                           
                                        <p:column headerText="StuId" width="11%">
                                            <h:outputText value="#{FEES_COLLECTION.stuId}" />
                                        </p:column>
                                        <p:column headerText="Student Name">
                                            <h:outputText value="#{FEES_COLLECTION.name}" />
                                        </p:column>
                                        <p:column headerText="Program" width="15%">
                                            <h:outputText value="#{FEES_COLLECTION.program}" />
                                        </p:column>
                                        <p:column headerText="Session" width="11%">
                                            <h:outputText value="#{FEES_COLLECTION.session}" />
                                        </p:column>
                                        <p:column headerText="Rcpt No" width="10%">
                                            <h:outputText value="#{FEES_COLLECTION.recptNo}" />
                                        </p:column>
                                        <p:column headerText="Amount" width="10%">
                                            <h:outputText value="#{FEES_COLLECTION.amount}" />
                                        </p:column>
                                        <p:column headerText="Voucher" width="11%">
                                            <h:outputText value="#{FEES_COLLECTION.AIBLVoucher}" />
                                        </p:column>                                                
                                    </p:dataTable>
                                </h:form>
                            </div>                                        
                        </div>
                    </div>
                </div>
                <div class="col-lg-12 col-md-12 col-sm-12" style="padding-top: 0px;">
                    <div class="col-lg-4 col-md-4 col-sm-4">

                    </div>
                    <div class="col-lg-4 col-md-4 col-sm-4">
                        <h:form id="form3">
                            <button type="button" class="btn btn-success btn-sm col-lg-5 col-md-5 col-sm-5">Save</button> 
                            <div class="col-lg-2 col-md-2 col-sm-2"></div>
                            <button type="button" class="btn btn-danger btn-sm col-lg-5 col-md-5 col-sm-5">Cancel</button> 
                        </h:form>
                    </div>
                    <div class="col-lg-4 col-md-4 col-sm-4">

                    </div>
                </div>                    
            </div>                    
        </div>                             
    </div>               
</ui:composition>

当我运行此代码时,它显示javax.faces.FacesException:找不到带有表达式“:form1:st_id”的组件,引用自“centrepage:form2:task-table”。

1 个答案:

答案 0 :(得分:0)

现在我得到了答案。应该是&#34;:centrepage:form1:st_id,..,...&#34;等等。底线是update =&#34; centrepage:form1:st_id&#34;。谢谢你们每个人