I have the next url: http://host:port/page.xhtml?response=something
I want render a p:message if response==something
I have the next code:
<h:panelGroup rendered="#{param.response == 'something'}">
<h:outputText value="message" />
</h:panelGroup>
this render a <div>message</div>
I want render a <p:messages /> or <p:growl /> and its value “message” if response==something
please help me to code this, and something else:
- Do I need a bean managed to send value to p:messages or p:growl?
- Do I need to call p:messages or p:growl from a
<p:commandButton />? - I can’t use
<h:body onload="callFunction()">’cause h:body is on
template xhtml<ui:insert name="content"></ui:insert>and my view
is on<ui:composition ... <ui:define name="content" >in other
xhtml, and h:body is common to several views
You’d really need to use
FacesContext#addMessage()to add a message to the context. On an initial request, your best bet is awith
You can by the way also use a separate
<p:messages globalOnly="true">or<p:growl globalOnly="true">to display only faces messages with anullclient ID.See also: