Simon, I think that's what the redirect tracker in the sandbox does/is
(phase listener).  It also handles t:saveState if I recall.



On 4/23/07, Simon Kitching <[EMAIL PROTECTED]> wrote:
Steve Torrefranca wrote:
> Simon Kitching wrote:
>>
>> What scenario do you have that needs to preserve messages on
>> navigation via redirect?
>>
> we are rewriting an old app.  the problem with forward, users complain,
> is that the name of the page (url) does not change and is misleading.
>
> the user has to go through a series of page where messages (if it is
> just info/warning) will be displayed on the next page.  i know its weird
> but that is how the old app is doing it and users demand we follow that
> flow.

Ah users, the source of all our problems :-)

Well, the issue is that a FacesContext is only request-scoped. Calling
FacesContext.addMessage stores the message on the FacesContext instance.
On a later http request messages are therefore not present.

One solution would be to have a custom tag that you place at the bottom
of a page which calls FacesContext.getMessages() and stores them into
the user's http session. Or you could just register your custom messages
that are expected to carry across pages directly into the session. Or
maybe a PhaseListener could do this (though you'd need to figure out
which messages are to be stored and which are not). A PhaseListener
could then be written that runs on pre-render and moves all messages in
the session onto the current FacesContext. Maybe the sandbox
RedirectTracker already does that...

Regards,

Simon

Reply via email to