tag p: commandButton does not do what's in the managedBean

0

I'm starting now on the jfs primefaces and I'm having trouble. My commandButton is not executing the method that is in the managedBean and is not firing anything on the console when it clicks on it (even when I put it there for it to shoot) ....

My managedBean

import java.io.Serializable;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;

@ManagedBean
public class GrowlView implements Serializable {

    private static final long serialVersionUID = 1L;
    private String message;

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public void saveMessage() {
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, new FacesMessage("Successful", "Your message: " + message));
        context.addMessage(null, new FacesMessage("Second Message", "Additional Message Detail"));
    }
}

The complete project is here at github link

My xhtml here

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui">

<h:head>
    <title>Hello Word</title>
</h:head>
<h:body>
    <h:form>
        <p:growl id="growl" showDetail="true" sticky="true" />

        <p:panel header="Growl">
            <h:panelGrid columns="2" cellpadding="5">
                <p:outputLabel for="msg" value="Message:" />
                <p:inputText id="msg" value="#{growlView.message}" required="true" />
            </h:panelGrid>

            <p:commandButton value="Save"
                actionListener="#{growlView.saveMessage()}" update="growl" />
        </p:panel>
    </h:form>
</h:body>
</html>
    
asked by anonymous 05.02.2017 / 02:18

0 answers