No messages displayed through h:messages

Hi all,

I have got a page that doesn't display the facesmessages I added to the context in my backingbean. I use the following code

Backing bean:

publicvoid addDisplayMessage(FacesMessage.Severity severity, String summary, String detail){

FacesMessage fm =new FacesMessage(severity,summary,detail);

FacesContext.getCurrentInstance().addMessage(null,fm);

}

addDisplayMessage(FacesMessage.SEVERITY_ERROR,"message","message");

JSP:

<t:div styleClass="messages">

<h:messages globalOnly="true" fatalClass="messagefatal" errorClass="messageerror" warnClass="messagewarn" infoClass="messageinfo" />

</t:div>

I do not understand why it doesnt work on this page, because it does work on other pages!

Also, it seems that the messages are removed from context when the action where I call addDisplayMessage() redirects me to the same page.

Thanks

Ruud.

[1311 byte] By [ruudvdlaara] at [2007-11-26 15:48:07]
# 1

Ok I already solved it myself....

I didnt have a navigation-rule in my facesconfig file because the page submits to itself.

Now I added one for this page without the <redirect/> tag and it works.

But I still dont understand it exactly, I know it has something to do with that FacesContext is request scope....

ruudvdlaara at 2007-7-8 22:07:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...