0

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.

Dreik
  • 140
  • 2
  • 2
  • 13
  • If you are learning jsf, start by reading http://jsf.zeef.com. Many 'important' jsf related things to know are addressed there, including links to many relevant stackoverflow posts – Kukeltje Jun 01 '17 at 15:17
  • Already tried that one :growl. Compilator says it cannot resolve the name ":growl". – Dreik Jun 01 '17 at 15:19
  • 1
    You're missing a h:head. It must always be there, even if empty – Jaqen H'ghar Jun 01 '17 at 18:11
  • Thank you ! it works! please make answer to the question so I can accept it – Dreik Jun 02 '17 at 07:41
  • And now when growl works my login form doesn't refresh automatically. How do I reslove it? – Dreik Jun 02 '17 at 08:25
  • New questions in ... new questions... – Kukeltje Jun 02 '17 at 09:31
  • @JaqenH'ghar: I would have thought the commandButton would not even be working... https://stackoverflow.com/questions/13452551/unable-to-understand-hhead-behaviour/ – Kukeltje Jun 02 '17 at 09:39

0 Answers0