Vote count:
0
I have a template file which contains primefaces growl component. I am using this template in another index.xhtml file. Now I am trying to add a FacesMessage from backing bean in @postconstruct function. However my index.xhtml file is not showing the growl.
template.xhtml
<div id="content-wrapper">
<div id="content" class="template-00-startpage clearfix">
<p:growl id="growl" showDetail="true" sticky="true" />
</div>
</div>
index.xhtml
<h:body>
<ui:composition template="/templates/Template.xhtml">
<ui:define name="leftContent">
<h:outputText value="#{backingBean.username}"></h:outputText>
</ui:define>
</ui:composition>
</h:body>
backingBean.java
@PostConstruct
private void init(){
username = "testing it";
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Info", "Trying to display this message");
FacesContext.getCurrentInstance().addMessage(null, msg);
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.update("growl");
}
I tried wrapping the <p:growl> component in <h:form id="main"> and then update main:growl, however it does not work.
I am not understanding what I am doing wrong. Is it necessary to trigger or update growl in .xhtml file or via commandButton?
asked 1 min ago
Not able to update "growl" in template from Backing bean
Aucun commentaire:
Enregistrer un commentaire