p:咆哮不起作用

时间:2017-06-01 15:05:13

标签: jsf primefaces jsf-2 growl

我的咆哮不起作用,我试着像我发现的那样,所以我在这里问我如何使我的咆哮工作。我的xhtml非常简单,注册和登录ui:include。我使用PrimeFaces 6.0。它与提出的答案明显不同,因为答案从那里起作用。

    <?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>

我使用它在userMB.Register()

中调用我的咆哮
 FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Success",  "Login success"));

我刚刚学习JSF,所以请耐心等待我。

0 个答案:

没有答案