I have one page where I add new item when I save data I go to other page where I want to see message that "Data was saved successful". I read that message belong to request scope that's why I am using the flash scope.
context.addMessage("calendarGameForm:growl", new FacesMessage("Data was saved successful");
context.getExternalContext().getFlash().setKeepMessages(true);
return outcome;
This is invoked by a save button on the first page addSeason.xhtml
.
<p:commandButton id="save" action="#{controller.add}"
value="#{msg.save}" ajax="true"
type="submit" update="@form"/>
The navigation rule is definied as follows.
<navigation-rule>
<from-view-id>/competitions/addSeason.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/competitions/calendarGame.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>fail</from-outcome>
<to-view-id>/competitions/calendarGame.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
But in the target page calendarGame.xhtml
I don't get my message.
<p:growl id="growl" globalOnly="true" sticky="true"/>
I am also getting this warning in the server log.
WARNING [javax.enterprise.resource.webcontainer.jsf.flash] (ajp--127.0.0.1-8009-1) JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash. Any values stored to the flash will not be available on the next request.
How I can solve my problem?