The general solution is to save the message in the session and display
it on a generic "display message" page.
The particular solution I'd use in this case would be to create a
request-scoped backing bean that holds the message to display, set the
message on the backing bean in my code, then use t:saveState on both
the display message page and the caller page to preserve that value
across the request.
I generally fetch/create the backing bean using this code, but maybe
there's a better way to do it.
ValueBinding binding =
FacesContext.getCurrentInstance().getApplication().createValueBinding("#{backingBean}");
BackingBean backingBean = (BackingBean
)binding.getValue(FacesContext.getCurrentInstance());
backingBean.setValue(value);
On 11/2/05, Robert Parsons <[EMAIL PROTECTED]> wrote:
> Hi,
>
> In past non-faces applications I have had a simple method in my
> controlling servlet that would automatically display a screen with a
> given message before redirecting to some given page. Something like this:
>
> ...
> displayRedirect("Your order was completed successfully", "index.jsp");
>
> In my JSF application I have navigation-rules for each outcome and a
> sepparate view for each message. So for the example above i'd have
> something like:
>
> <navigation-case>
> <from-outcome>complete</from-outcome>
> <to-view-id>/order_complete.xhtml</to-view-id>
> </navigation-case>
>
> The 'order_complete.xhtml' page would have the message "Your order was
> completed successfully" and then a timed redirect to some other page.
> I'm not completley stupid and am using a template (btw i'm using
> facelets too) for all the redirection pages, but I'm still having to
> create a page for each outcome.
>
> Is there some nice way I can achieve this kind of behaviour without
> making an individual view for all the messages?
>
> Any comments welcome.
>
> Thanks,
> -Robert.
>
>