我正在使用primefaces,我需要根据候选人选择的选择框显示申请人的总数。因为我是primefaces的新手,现在不知道如何传递参数。我正在给我的代码吼叫。
<h:panelGrid columns="2" cellspacing="4" columnClasses="control-label">
<h:outputText
value="#{msg['elicense.examinationform.personal.proposeofexam']}" />
<p:selectOneMenu id="propExam" value="#{issueAdmitCardBean.examination}"
converter="omnifaces.SelectItemsConverter" editable="false"
required="true" label="Examination Applied For" styleClass="dropdownWidth">
<f:selectItem itemLabel="---Select One---" itemValue="0" />
<f:selectItems value="#{issueAdmitCardBean.testExamNames}" var="test" itemLabel="#{test.name}" itemValue="#{test}" />
</p:selectOneMenu>
<h:outputText value="Select Degree Category :" />
<p:selectOneMenu id="degreeList"
value="#{issueAdmitCardBean.degree}" editable="false"
converter="omnifaces.SelectItemsConverter" required="true"
label="Please Select degree" styleClass="dropdownWidth">
<f:selectItem itemValue="" itemLabel="---Select One---" />
<f:selectItems value="#{issueAdmitCardBean.degreeNames}"
var="degree" itemLabel="#{degree.name}" itemValue="#{degree}" />
</p:selectOneMenu>
<h:outputText value="Center of Examination :"/>
<p:selectOneMenu id="centerId" value="#{issueAdmitCardBean.center}" editable="false"
converter="omnifaces.SelectItemsConverter" required="true" label="Please select Center"
styleClass="dropdownWidth">
<f:selectItem itemValue="" itemLabel="---Select One---"/>
<f:selectItems value="#{issueAdmitCardBean.centerNames}" var="center"
itemLabel="#{center.name}" itemValue="#{center}"/>
<p:ajax listener="#{issueAdmitCardBean.readVenuefromCenter(issueAdmitCardBean.center.id)}" update="venueNames" />
<p:ajax listener="#{issueAdmitCardBean.selectContByid(issueAdmitCardBean.center.id,issueAdmitCardBean.examname.id,issueAdmitCardBean.degree.id)}" update="venueNames" />
</p:selectOneMenu>
<h:outputText value="Total No. of Candidates Under this Category :"/>
<h:outputText value="#{issueAdmitCardBean.getTotalNoofCandidates}"/>
请帮助我解决它。提前谢谢。
我有问题。我在最后一个selectone菜单按钮上使用了我的ajax按钮。但我必须改变它,好像在我的第一个选择菜单中更改一个值,我的ajax应该工作。我的问题是如果我在这里使用相同的方法我会得到空指针异常。请帮帮我怎样才能改变它。
答案 0 :(得分:0)
您可以尝试第二次<p:ajax>
<p:ajax listener="#{issueAdmitCardBean.selectContByid(issueAdmitCardBean.center.id,issueAdmitCardBean.examination.id,issueAdmitCardBean.degree.id)}" update="venueNames" process="propExam degreeList centerId"/>