h:Nachrichten, nicht die Nachrichten anzeigen, wenn p:commandButton gedrückt wird

Ich habe ein problem mit der h:messages-tag in JSF, die einfach zeigt keine Meldungen. In der Glassfish log sind keine Fehler, wenn ich auf die Schaltfläche klicke.
Das setup ist wie folgt:

test.xhtml:

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui" 
    xmlns:j="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
    <title>test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</h:head>
<h:body>
    <h:messages globalOnly="true"/>
    <h:form id="loginform">         
        <p:commandButton id="testButton" value="Test"
          action="#{loginSessionBean.test()}" />
    </h:form>
</h:body>
</html>

Mit Der SessionScopedBean:

@ManagedBean
@SessionScoped
public class LoginSessionBean implements Serializable {

private static final long serialVersionUID = 1L;
...
public String test(){
     FacesContext fc = FacesContext.getCurrentInstance();
     fc.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Test!", null)); 
    return "";
}
InformationsquelleAutor hFonti | 2013-04-23
Schreibe einen Kommentar