Jsf 2 更新表单后,所有对话框都将刷新到JSF中
我试图通过code means onClick动态添加对话框,它仅在刷新表单时显示,但它刷新了所有对话框,所有对话框字段都被清除,所有内容都变为新内容 如何在不刷新表单的情况下显示对话框 其数据输入表单,希望一次打开多个表单 谢谢Jsf 2 更新表单后,所有对话框都将刷新到JSF中,jsf-2,primefaces,Jsf 2,Primefaces,我试图通过code means onClick动态添加对话框,它仅在刷新表单时显示,但它刷新了所有对话框,所有对话框字段都被清除,所有内容都变为新内容 如何在不刷新表单的情况下显示对话框 其数据输入表单,希望一次打开多个表单 谢谢 UIComponent component = FacesContext.getCurrentInstance().getViewRoot().findComponent("webForm"); if (component != null) {
UIComponent component = FacesContext.getCurrentInstance().getViewRoot().findComponent("webForm");
if (component != null) {
int count = countDialog(component.getChildren()) + 1;
Dialog tp = new Dialog();
tp.setVisible(true);
tp.setWidgetVar("widget" + count);
component.getChildren().add(tp);
RequestContext request = RequestContext.getCurrentInstance();
request.update("webForm");
}
index.xhtml
因为您正在更新整个表单,这是WYE,但我如何才能只显示新添加的对话框?我找到了解决方案,它是在setRendered方法中找到的,谢谢
<p:menuitem value="New Dialog" actionListener="#{dialogsView.addDialog}", update="webForm"/>