p:growl not working

1.1k Views Asked by At

My growl doesn't work, I tried like eveyrthing I found so I'm asking here how to make my growl work. My xhtml is really simple registration and login enclosed with ui:include . I'm using PrimeFaces 6.0. It is definitely different from proposed answer since answers from that doesn't work.

    <?xml version="1.0" encoding="UTF-8"?>
<!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:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

<f:view>
    <h:body>            
            <h:form>
                <p:growl id="growl" showDetail="true" sticky="true" />
                <h:inputText id="Email" validatorMessage="Niepoprawny format maila" value="#{userMB.tmp.email}"
                label = "Email"/>
                <h:messages for="Email" style="color:red;margin:8px;" />
                <br/>

                <h:inputText id="firstName" validatorMessage="Pole nie moze byc puste"
                             value="#{userMB.tmp.firstName}">FirstName</h:inputText>
                <h:messages for="firstName" style="color:red;margin:8px;" /><br/>

                <h:inputText id="lastName" validatorMessage="Pole nie moze byc puste"
                             value="#{userMB.tmp.lastName}">LastName</h:inputText>
                <h:messages for="lastName" style="color:red;margin:8px;" /><br/>

                <h:inputSecret id="password" validatorMessage="Pole nie moze byc puste"
                               value="#{userMB.tmp.password}">Password</h:inputSecret>
                <h:messages for="password" style="color:red;margin:8px;" /><br/>


                <p:commandButton update="growl"  actionListener="#{userMB.Register()}"
                                 icon="ui-icon-check">Register</p:commandButton>
            </h:form>

        <h:panelGroup>
            <ui:include src="login.xhtml" />
        </h:panelGroup>
    </h:body>
</f:view>

</html>

I'm using this to call my growl in userMB.Register()

 FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Success",  "Login success"));

I'm just learning JSF so please be patient with me.

0

There are 0 best solutions below