即使当我在输入字段中输入有效值时,它们仍在托管bean中提供空值。 我正在为他们所有的空值。 我已经尝试调试,但无法找出问题所在。
需要渲染,因为在用户单击“批准”按钮后,“注册”页面-输出标签,输入字段,“批准”,“拒绝”按钮被删除,并显示outputLabel value =“ Registration Approved
rendered="#{approveRejectMB.registrationNotComplete and !approveRejectMB.registrationRejected}">
根据用户要求更改了输出和输入字段值。如果他选择选项1,则输出和输入字段的值将显示为1。
rendered="#{registrationMB.registrationEntity.registrationType.registrationTypeId eq 2}"/>
rendered="#{registrationMB.registrationEntity.registrationType.registrationTypeId eq 1}"
Registrationpage.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:pe="http://primefaces.org/ui/extensions"
>
<p:panel id="registrationfinal" styleClass="panelNoBorder">
<p:fieldset toggleable="true" toggleSpeed="500" legend="Registration">
<h:panelGrid columns="1" styleClass="panelNoBorder">
<p:row>
<p:messages for="RegistrationSubmitMessageId" showDetail="true" p:autoUpdate="true" closable="false" />
</p:row>
</h:panelGrid>
<h:panelGrid columns="2" styleClass="panelNoBorder" rendered="#{approveRejectMB.registrationNotComplete and !approveRejectMB.registrationRejected}">
<p:outputLabel value="Student Number"/>
<p:row>
<p:inputText id="studentNumber" maxlength="10" style="width: 85%;"
value="#{approveRejectMB.registrationApprovalEntity.studentNumber}">
</p:inputText>
</p:row>
<p:outputLabel value="Subject Number"/>
<p:row>0
<p:inputText id="subjectNumber" maxlength="10" style="width: 85%;"
value="#{approveRejectMB.registrationApprovalEntity.subjectNumber}">
</p:inputText>
</p:row>
<p:outputLabel value="Number of days Approved" rendered="#{registrationMB.registrationEntity.registrationType.registrationTypeId eq 1}"/>
<p:row>
<p:inputText id="numberDaysApproved" maxlength="10" style="width: 85%;"
value="#{approveRejectMB.registrationApprovalEntity.numberDaysApproved}" rendered="#{registrationMB.registrationEntity.registrationType.registrationTypeId eq 1}">
</p:inputText>
</p:row>
<p:outputLabel value="Evaluation Result" rendered="#{registrationMB.registrationEntity.registrationType.registrationTypeId eq 2}"/>
<p:row>
<p:inputText id="evaluationResult" maxlength="10" style="width: 85%;"
value="#{approveRejectMB.registrationApprovalEntity.evaluationResult}" rendered="#{registrationMB.registrationEntity.registrationType.registrationTypeId eq 2}">
</p:inputText>
</p:row>
</h:panelGrid>
<br></br><br>
</br><br></br>
<p:commandButton id="approveRegistration" value="Approve" type="button" onclick="PF('waitSpinner').show();" oncomplete="PF('waitSpinner').hide();"
actionListener="#{approveRejectMB.approveRegistration}" update="registrationfinal"
widgetVar="approveRegistrationVar" rendered="#{approveRejectMB.registrationNotComplete and !approveRejectMB.registrationRejected}">
<p:ajax listener="#{approveRejectMB.approveRegistration}" />
</p:commandButton>
<p:commandButton id="rejectRegistration" value="Reject" type="button"
onclick="PF('rejectComments').show();" onkeypress="PF('rejectComments').show();" style="display:inline"
actionListener="#{approveRejectMB.rejectRegistration}"
widgetVar="rejectRegistrationVar" rendered="#{approveRejectMB.registrationNotComplete and !approveRejectMB.registrationRejected}" >
<p:ajax listener="#{approveRejectMB.rejectRegistration}" />
</p:commandButton>
<p:outputLabel value="Registration Approved" rendered="#{!approveRejectMB.registrationNotComplete}" />
<p:outputLabel value="Registration Rejected" rendered="#{approveRejectMB.registrationRejected}" />
</h:panelGrid>
<h:panelGrid columns="1" styleClass="panelNoBorder">
<ui:include src="rejectionRegistrationCommentsDetail.xhtml" />
</h:panelGrid>
</p:fieldset>
</p:panel>
registrationApprovalEntity.setStudentNumber(studentNumber);
registrationApprovalEntity.setSubjectNumber(subjectNumber);
registrationApprovalEntity.setNumberDaysApproved(numberDaysApproved);
registrationApprovalEntity.setEvaluationResult(evaluationResult);
实际结果-获取StudentNumber,subjectNumber,numberDaysApproved,evaluationResult的空值
预期结果- 用户必须能够设置
的值registrationApprovalEntity.setStudentNumber(studentNumber);
registrationApprovalEntity.setSubjectNumber(subjectNumber);
registrationApprovalEntity.setNumberDaysApproved(numberDaysApproved);
registrationApprovalEntity.setEvaluationResult(evaluationResult);