This should be a pretty simple problem. In the CRUD app that I'm using
as a proof-of-concept for using JSF here at work I've got everything
working and think I'm starting to understand some of the nuances of
JSF. But one thing that is not working as I expected is the handling of
When a user creates an object (say a contact), after filling out the
form and hitting submit they are redirected to the contact list page via
the navigational rule:
That works and all, but in the contactHandler.saveContact() method I am
also adding an informational message that the contact was saved just to
give the user a warm fuzzy feeling. So, in my list.jsp page I have the
<h:view> followed immediately by <h:messages />. But nothing is
displayed when the user is redirected to this page after successfully
adding a contact. I know I'm adding it right because I'm doing it the
same way on the /contact/edit.jsp page which doesn't redirect after a
The only things I can think of that would cause this is that JSF is
processing the /contact/add.jsp page before doing the redirect, and
there is a <h:messages /> tag in there in case there is some validation
error or some other problem. But that's just a guess.
The other possibility to me is that the messages are somehow page
specific, so a message generated on one page won't show up on another.
In which case my question is how do I get around this?
Could it maybe have something to do with the backing bean that generates
the message being request scoped rather than session scoped?
Once again, thanks for the help