If you finish this up, we could add it to the code base and put documentation on it onto the homepage - would be a great feature, I suppose.
regards,
Martin
On 8/5/05, Enrique Medina <[EMAIL PROTECTED]> wrote:
Sorry, but this code won't work because it's not thread-safe...
But the workaround is as easy as having the message stored not in the listener itself, but in a named object in the session. Then from the listener you can access the session and guess whether there are any messages, in a similar manner ;-)2005/8/5, Enrique Medina <[EMAIL PROTECTED] >:Hi again, what is promised is a debt...
Here I attach my Java class to handle "lost" messages when using "Redirect after Post" pattern (sorry for my comments in Spanish, but I think the code is quite self-explainable ;-).
>From any of your beans which may want to show a message to the user, you just have to use:
MensajesHandler.setNotification(FacesMessage notification)
And also remember to register the listener within JSF:
<lifecycle>
<phase-listener>
com.xxxx.yyyy.web.bean.MensajesHandler
</phase-listener>
</lifecycle>
Hope it helps ;-)2005/8/5, Johannes Hiemer < [EMAIL PROTECTED]>:
Hi Enrique,
I think that would probably the best and cleanest solutions yes.
Let me know when you finished it. Would like test it! :)
Regards Johannes
"MyFaces Discussion" < [email protected]> schrieb am 05.08.05 14:52:09:
> Hi Johannes,
>
> I have just read your solution carefully and I think I'm going to try to implement the phaselistener right now.
>
> Just one comment, how are messages cleaned up from request to request? Should they be simply removed by the PhaseListener when injected into the FacesContext again?
>
> 2005/8/5, Johannes Hiemer <[EMAIL PROTECTED]>:
> Hi Enrique,
> I worked out a solution just a few hours ago have look, perhaps it meets your requirements:
> http://www.mail-archive.com/users%40myfaces.apache.org/msg06650.html
>
> What is missing, as martin mentioned in one of his replies, that we could put the getNotification in a phaseListener, what I am currently trying to do, but not really getting to work properly.
> If you have a bit time and motiviation, you can provide a phaseListener, that replaces the notificationBean.
>
> I hope I could help you.
>
> Regards Johannes
>
> "MyFaces Discussion" <[email protected]> schrieb am 05.08.05 14:20:15:
> > Hi,
> >
> > You may be familiar with this two articles regarding the problem of refreshing the page, double submit, etc:
> >
> > http://www.theserverside.com/articles/article.tss?l=RedirectAfterPost
> > http://www.theserverside.com/articles/article.tss?l=RedirectAfterPost2
> >
> > Using the navigation rules in JSF it works great, but there is a problem with messages: they get lost in a redirect. This problem has already been addressed by some people:
> >
> > http://raibledesigns.com/page/rd/20041015
> >
> > but I haven't found a suitable solution yet.
> >
> > I need to present the user with a message once he has submitted the form to tell him everything has gone well.
> >
> > How can I preserve the messages in a redirect using JSF?
> >
>
>
> ______________________________________________________________
> Verschicken Sie romantische, coole und witzige Bilder per SMS!
> Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
>
>
>
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193

