This image should explain the problem clearly. I'm using p:messages from primefaces, but I guess it should apply to h:messages as well.
I want to associate a <p:messages>
component with the form in which it is placed. In this case, the message is received by both the components.
The error is generated by the server, and I'm using this function:
public static void showErrorMessage(String errorString) {
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, errorString, "");
FacesContext.getCurrentInstance().addMessage(null, facesMsg);
}
How can I solve this? Thanks!
Edit: Clarification: Both the components are on the same page.