0

我有几个密码字段和一个下拉框。每当更改下拉值(值更改事件)时,我都会显示一个弹出窗口以同意条款和条件。一旦接受条款和条件,密码字段就会被清除。

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>

豆豆

public void agreed() {
  //set some variables
}
public void disagreed() {
  //set some variables
}

由于某种原因,整个页面正在呈现,因为尚未提交表单,因此未在 bean 中设置密码值。我该如何预防?

4

0 回答 0