0

I've got a simple commandbutton which fires an action method in a backing bean. This method returns a string. In some cases null, in some cases an explicit navigation.

 <p:commandButton value="Button" action="#{obj.submit}" onstart="PF('busy').show();" oncomplete="PF('busy').hide()">

In case navigation is triggered, I want to show a popup. But how can I check if the method returns an empty string / null ?

Steven De Groote
  • 2,187
  • 5
  • 32
  • 52

1 Answers1

0

Try to use this

<p:commandButton value="Button" action="#{obj.submit}">

And in your method "submit" you have to make the assessment of the case

public String submit(){
your code
....
if (value!=null){
RequestContext.getCurrentInstance().execute("PF('busy').show();"); 
return value;
} else {
return value; 
}
}
Christian
  • 827
  • 6
  • 14