If "success" is returned a navigation rule fires and we move to another page.
If "failure" is returned a different navigation rule fires and we return to the same page (both these occur via a redirect).
In the case of a "failure" the page will render a modal dialog, which when the user clicks on "Close" should navigate to a third page (due to another navigation rule) however it still stays on the same page. Can anyone suggest why this might be, or suggest another way of achieving the same page flow?
I'm running:
JSF 2.0
Weblogic 10.3.5
PrimeFaces 2.2.1
Code: Select all
<h:form id="answerQuestions">
<h:commandButton id="answerButton" value="Answer" action="#{bean.answer}" />
<p:dialog header=""
closable="false"
rendered="#{flash.wrongAnswer}"
visible="true" modal="true"
widgetVar="dlg" resizable="false">
<h:outputLabel value="Sorry wrong answer" />
<p:button id="modalClose"
value="Close"
action="failureAcknowledged"
ajax="false" onclick="dlg.hide();" />
</p:dialog>
</h:form>
public String answer()
{
Flash flash = FacesContext.getCurrentInstance().getExternalContext().getFlash();
if(validateSelections())
flash.put("wrongAnswer", false);
return "success";
}
else
{
flash.put("wrongAnswer", true);
return "failure";
}
}