Primefaces p:仅在单击p:commandButton两次后显示对话

Primefaces p:仅在单击p:commandButton两次后显示对话,primefaces,jsf-2.2,Primefaces,Jsf 2.2,我正在尝试删除的一行 对于第一次单击“删除”按钮,无法显示对话框 对于第二次单击删除按钮,将显示对话框,因此操作成功完成 这个Bean是: @Component() @范围(“请求”) 公开课培训 { @自动连线 公共列表培训(@Qualifier(“applicationManager”)applicationManager appMgr) { this.appMgr=appMgr; lfs=新的ArrayList(); tm=新的培训模式(); 编队=新编队(); } @施工后 公共无

我正在尝试删除的一行

  • 对于第一次单击“删除”按钮,无法显示对话框
  • 对于第二次单击删除按钮,将显示对话框,因此操作成功完成
这个Bean是:

@Component()
@范围(“请求”)
公开课培训
{
@自动连线
公共列表培训(@Qualifier(“applicationManager”)applicationManager appMgr)
{
this.appMgr=appMgr;
lfs=新的ArrayList();
tm=新的培训模式();
编队=新编队();
}
@施工后
公共无效初始化()
{
System.out.println(“你好世界”);
}
public void selectedRow()
{
状态1=假;
状态2=错误;
tm=(TrainingModel)listDatas.getRowData();
formation=appMgr.listTrainingsByRef(tm.getId()).get(0);
vb.集合形成(形成);
如果(
(appMgr.listTrainersByRefTraining(formation.getFormationId()).size()=0)
&&
(formation.getSalleEspace()==null)
)
{status1=true;}
其他的
{status2=true;}
}
}

当按钮操作通过p:dialog单击use with widget name。onclick方法的此按钮通过widget name调用。添加如下代码所示的对话框

<p:dialog header="Basic Dialog" widgetVar="dlg1" minHeight="40">
<h:outputText value="Resistance to PrimeFaces is futile!" />


hello@hsntpn,非常感谢您的回复,但我想在onclick上使用条件(if…if…),就像我在问题中提到的那样。
<p:dialog header="Basic Dialog" widgetVar="dlg1" minHeight="40">
<h:outputText value="Resistance to PrimeFaces is futile!" />