You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Richard Yee <ri...@gmail.com> on 2008/05/30 01:56:07 UTC

[Trinidad] calling FacesContext.addMessage from a commandButton with partialSubmit="true"

It seems that if the partialSubmit="true" attribute is used on a
commandButton that is used to submit a page, a redirect is done to display
the next page rather than a forward. This makes displaying a message to the
user with a call
to FacesContext.getCurrentInstance().addMessage(FacesMessage) in the method
that is specified in the commandButton action attribute not work since th
emessage is stored in request scope.

I am interested in hearing how others deal with this situation. I am
currently handling this by setting a session attribute with the FacesMessage
and then in the backing bean of my new view page, I am checking the session
for the attribute, and if it exists, I then call
FacesContext.getCurrentInstance().addMessage() with it and removed the
attribute from the session.

Can anyone suggest a better way of doing this?

The reason I am setting partialSubmit="true" is to be able to use the
<tr:statusIndicator> tag on my page to display a 'Processing...' message.

Thanks in advance,

Richard