JSF How to redirect to another page defined at runtime using Command Button?
I would like to call a Bean method and then redirect the user to a different page which is defined at runtime when that method is called and output by some runtime computation: For example:
on .xhtml:
<p:selectBooleanCheckbox value="#{userAuth.parameterA}"/>
<p:commandButton value="Save Changes"
id="withIcon"
type="submit"
actionListener="#{userAuth.saveChanges()}"
icon="ui-icon-disk" />
on bean:
public String saveGhanges(){
this.entity.save(); //dummy code)
if (this.parameterA == true) return "ATrue.xhtml";
if (this.parameterA == false) return "AFalse.xhtml";
}
+3
source to share