[prev in list] [next in list] [prev in thread] [next in thread] 

List:       myfaces-user
Subject:    [Trinidad] calling FacesContext.addMessage from a commandButton with partialSubmit="true"
From:       "Richard Yee" <richard.k.yee () gmail ! com>
Date:       2008-05-29 23:56:07
Message-ID: 11f14d500805291656u5a1e32e2tdff5c9947bbf5ba9 () mail ! gmail ! com
[Download RAW message or body]

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

[Attachment #3 (text/html)]

<div>It seems that if the partialSubmit=&quot;true&quot; 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&nbsp;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.</div>

<div>&nbsp;</div>
<div>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.</div>

<div>&nbsp;</div>
<div>Can anyone suggest a better way of doing this?</div>
<div>&nbsp;</div>
<div>The reason I am setting partialSubmit=&quot;true&quot; is to be able to use \
the&nbsp; &lt;tr:statusIndicator&gt; tag on my page to display a \
&#39;Processing...&#39; message.</div> <div>&nbsp;</div>
<div>Thanks in advance,</div>
<div>&nbsp;</div>
<div>Richard</div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic