문제

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" />
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top