How to update message components associated with <p:commandButton ajax="false">? <p>I need your assistant in updating the <code>&lt;p:message&gt;</code> component in a JSF page once the non-ajax <code>&lt;p:commandButton&gt;</code> is clicked. Currently in the case, I need to validate if the employee number is null, then show the error message in the message component, else, nothing to be shown. But now,the form is not showing anything once the <code>&lt;p:commandButton&gt;</code> is clicked.</p> <p>Below is the JSF code:</p> <pre><code>&lt;h:form id="form"&gt; &lt;p:inputText value="#{pdf.refNo}"/&gt; &lt;p:message id="message" for=":form:cmd2" showDetail="true"/&gt; &lt;p:commandButton id="cmd2" value="Validate" ajax="false" actionListener="#{pdf.validate}"/&gt; &lt;/h:form&gt; </code></pre> <p>And the Java bean is:</p> <pre><code>public void validate() { if (refNo.equals("") || refNo == null) { FacesContext.getCurrentInstance().addMessage(":form:cmd2", new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!", "Please enter the Employee No.")); } } </code></pre> <p>So is the above code is correct and how to show the message once the button is clicked?</p>