我有几个密码字段和一个下拉框。每当下拉值更改(值更改事件)时,我都会显示一个弹出窗口以同意条款和条件。一旦条款和条件被接受,密码字段就会被清除。
XHTML文件
Enter Password: <h:inputSecret value="#{myBean.password}" />
Confirm Password: <h:inputSecret value="#{myBean.confirmPassword}" />
Select an Amount: <h:selectOneMenu value="#{myBean.amount}">
<f:selectItems value="#{myBean.amountValues}" />
<f:ajax event="valueChange" render="@this">
<rich:componentControl target="pnl" operation="show" />
</f:ajax>
</h:selectOneMenu>
<rich:popupPanel id="pnl" domElementAttachment="form" height="150" width="400" moveable="false" resizeable="false">
<f:facet name="header"><h:outputText value="Do you accept our Terms&Conditions"/></f:facet>
<h:commandButton value="Yes" immediate="true" action="#{myBean.agreed}"/>
<h:commandButton value="No" immediate="true" action="#{myBean.disagreed}" />
</rich:popupPanle>
为myBean
public void agreed() {
//set some variables
}
public void disagreed() {
//set some variables
}
由于某些原因,整个页面正在呈现,因为表单尚未提交,密码值未在bean中设置。我该如何预防?