Jsf primefaces commandlink不会显示模式对话框

Jsf primefaces commandlink不会显示模式对话框,jsf,primefaces,Jsf,Primefaces,您好,我有一个commandLink,它在我的烘焙bean中执行一个方法,该方法调用一个ejb,该ejb构建一个字符串并将其作为bean的一个属性(使用getter和setter),执行该方法后,应该引发一个模态对话框,仅显示该属性的值,但它不会,我看到了构建链运行但不提升对话的方法,这是我的代码: xhtml: <ui:composition> <p:panelGrid columns="3" style="width: 100%" > <h:form id="h

您好,我有一个commandLink,它在我的烘焙bean中执行一个方法,该方法调用一个ejb,该ejb构建一个字符串并将其作为bean的一个属性(使用getter和setter),执行该方法后,应该引发一个模态对话框,仅显示该属性的值,但它不会,我看到了构建链运行但不提升对话的方法,这是我的代码:

xhtml:

<ui:composition>
<p:panelGrid columns="3" style="width: 100%" >
<h:form id="headerForm">
<p:column style="width: 15%;height:auto; text-align: center;">
<p:graphicImage value="#{loginBean.url}" style="align:center;"/>
</p:column>                      
<p:column>
<div align="center">
<h:outputText styleClass="titleHeader" value="#{loginBean.entityName}" />
</div>
</p:column>
<p:column style="width: 15%;height:auto; text-align: center;">
<div align="right">
<h:commandLink onComplete="PF('dlg').show(); return false;" type="button" ajax="false" action="#                {xxxxBean.createString}">
<h:outputText value="Contact" />
</h:commandLink>
</div>
</p:column>
</h:form> 
</p:panelGrid>
<p:dialog id="dlg" header="Some title here" widgetVar="dlg" modal="true">  
<h:outputText value="#{xxxxBean.stringBuild}" />  
</p:dialog>     
</ui:composition>

支持bean:

@ManagedBean
@SuppressWarnings("serial")
public class XxxxBean implements Serializable{

private String stringBuild;
private someBeanRemote ejb;

public XxxxBean() {
// TODO Auto-generated constructor stub   
try{
ejb = EjbConsumer.getRemoteEjb();
}catch(Exception e){
e.printStackTrace();
}

}    

public void createString(){
List<someObject> list = ejb.findAllActiveObjects(Constants.TOP);
String temp = "";
if( list!=null && list.size() > 0 ){
for(int i=0; i < list.size(); i++){
temp += list.get(i).getName() + "<br/>";        
}

this.stringBuild= temp;
}       

System.out.println(this.stringBuild);

}

public void setStringBuild(String stringBuild) {
this.stringBuild= stringBuild;
}

public String getStringBuild() {
return stringBuild;
}

}
@ManagedBean
@抑制警告(“串行”)
公共类XXBean实现了可序列化{
私有字符串生成;
私有somebeanremoteejb;
公共xxxbean(){
//TODO自动生成的构造函数存根
试一试{
ejb=EjbConsumer.getRemoteEjb();
}捕获(例外e){
e、 printStackTrace();
}
}    
public void createString(){
List=ejb.findAllActiveObjects(Constants.TOP);
字符串temp=“”;
if(list!=null&&list.size()>0){
对于(int i=0;i”;
}
这个.stringBuild=temp;
}       
System.out.println(this.stringBuild);
}
公共void setStringBuild(字符串stringBuild){
this.stringBuild=stringBuild;
}
公共字符串getStringBuild(){
返回stringBuild;
}
}

提前感谢

您正在使用
ajax=false
oncomplete

oncomplete
:在ajax请求完成时执行客户端回调

改为:

<p:commandLink oncomplete="PF('dlg').show();" action="#{yourBean.youraction}"></p:commandLink>

这是默认的ajax=true,一切都应该正常