//I'm having a command button like
<af:commandButton text="Validate"
binding="#{backingBeanScope.backing_Second.cb2}"
id="cb2"
action="#{backingBeanScope.backing_Second.cb2_ClickAction}">
<af:showPopupBehavior popupId="p11" />
</af:commandButton>
//Popup dialog contains
<af:popup id="p11">
<af:dialog id="d2"
dialogListener="#{backingBeanScope.backing_Second.getAddressDialogListener}">
<af:panelLabelAndMessage label="Enter the Password for DataSource " id="plam13"/>
<af:inputText label="password" value="#{backingBeanScope.backing_Second.password}" id="it455"/>
</af:dialog>
</af:popup>
//Dialog listener in backing bean having
public void getAddressDialogListener(DialogEvent dialogEvent) {
System.out.println("" + this.getPassword());
SampleJdbc.DB_PASSWORD=this.getPassword();}
Run Code Online (Sandbox Code Playgroud)
支持bean中的cb2_ClickAction返回onestring,并使用此字符串重定向到下一页.我的要求是,当我点击验证时,它将在弹出窗口中询问密码并获取该密码,然后调用cb2_ClickAction并重定向到下一页.它无法正常工作.
使用命令按钮仅显示弹出窗口
<af:commandButton text="commandButton 1" id="cb1">
<af:showPopupBehavior popupId="p1"/>
</af:commandButton>
<af:popup id="p1">
<af:dialog id="d2" dialogListener="#{PopupBean.myDialogListner}"/>
</af:popup>
Run Code Online (Sandbox Code Playgroud)
并使用dialogListener验证密码和重定向
public void myDialogListner(DialogEvent dialogEvent) {
if(dialogEvent.getOutcome() == DialogEvent.Outcome.ok){
FacesContext fctx = FacesContext.getCurrentInstance();
try {
fctx.getExternalContext().redirect("untitled1.jspx");
} catch (IOException e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8982 次 |
最近记录: |