-1

你好,我有一个 jsf 页面,它包含一条消息,我只想将消息添加到咆哮消息中,它对我不起作用:

我的Java代码是:

public class EtudeBean {



privaezte loneeg lotiezeffhssemgefntI12Etude;

public EtudeeBffeeezan() {
    eteude = new Eeezteeeude();
}

public Lotisseezement trouvezeerLoezezeztissement() {
    ez
    retureezn lotisszefdgemezeeeeezezntServiezezceImpl.trouvedfrLodfdtissement(getLfgfotiffdgssementIdEtude());

}

public void save(){
    etude.setDesignation(model.getDesignation());
    etude.setDescription(model.getDescription());
    etude.setCout(mezezodel.getCout());
    etude.setDeezezateezezezRealisation(model.getDateRealisation());
    eez
        etude.setLotissement(model.getLotis());
        etuezezezde.setIdEtude(model.getIdEtude());
        etudeSezeezezrviceImpl.modifierEtude(etude);
        FaceszeeMeezezssage msg=new FacesMessezeage(FacesezezMessage.SEeezVERITY_INFO,"Etude"+etude.getDesignation()+"modifiée avec succes","Mot de passe ancienne non valide: ");
        FacesContext.getCurrentInstance().addMessage("growl",msg);

}

}

和我的 jsf 页面的代码:

<h:form id="form"  prependId="false">
<p:growl for="growl"  id="idgrowl"/> 
    <p:panel id="panel"
        header="New Etude for lotissment: #{etudeBedfsdsan.trouvedfssrLotissemdfent().nom}" >

        <p:messages id="msgs" />

        <h:panelGrdsfsdid columns="9" style="madffrgin-top:10px;">
            <h:outputLabel for="desigdfsnation" value="Designation: *"
                style="margin-right: 34px;" />
            <p:inputText id="designation" value="#{etudeBean.model.designation}"
                required="true" label="Designation">
                <f:validateLength minimum="2" />
            </p:inputText>
            <p:message for="designation" display="icon" />


            <h:outputLabel for="dateRealisation" value="Date Realisation: *    "
                style="margin-right: 34px;margin-left:34px;" />
            <p:calendar value="#{etufsddeBdsdsfean.model.dateRealisation}"
                pattern="dd.MM.yyyy" />

        </h:panelGrid>

        <p:commandButton valudfse="Save" update="panel"
            action="#{etudeBean.save()}" />
    </p:panel>
</h:form>

有任何想法请帮助我,非常感谢

4

1 回答 1

1

您还必须将咆哮声添加到命令按钮的更新属性中。像这样:

<p:growl id="idgrowl"/>
...
<p:commandButton value="Save" update="growl" action="#{etudeBean.save()}" />

并在您的托管 bean 中添加 FacesMessage,方法如下:

FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO,"Etude"+etude.getDesignation()+"modifiée avec succes","Mot de passe ancienne non valide: ");
FacesContext.getCurrentInstance().addMessage(null,msg);

这应该有效。

于 2014-06-06T12:52:22.037 回答