I would like to update different components depending on results in the bean. Right now I am using:
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "test","test"));
And updating the proper component with:
<p:commandButton actionListener="#{Controller.method}" update="messageId"/>
<p:messages id="messageId"/>
Is there a different way to do it? From the bean, can I specify which message component to send the message to?
As Vasil said - you can bind the messages to ids (component doesn't necessarily need to exist for that id'
FacesContext.getCurrentInstance().addMessage("idspecified", new FacesMessage("Header", "body"));
And then in your xhtml use
<p:message for="idspecified" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.