How to solve “p:message not working” in Primefaces?

I’m building a form that let the user enter database connection parameters. Once the parameters are typed the user can test (btnTester) if connection can be established with its parameters.

In all cases, a message is produced for the user. Here the example of a failed connection attempt from backing bean code :

(...)
addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Connection failed.", t.getLocalizedMessage()));
(...)

Here is the form code. I’d like the message to appear in a p:message. Unfortunately, nothing happen. No message (connection successful or not) is displayed after the button : Even with the global attribute set to false or true.

<h:form prependId="false">
(...)
  <h:panelGrid>                 
    <!-- Other form components here -->
    <f:facet name="footer">
      <p:commandButton
          id="btnTester"
          value="Tester"
          actionListener="#{assistantCreationSourcesBean.testerConnexionBase}"
          update="msgTester" />
          <p:message id="msgTester" for="btnTester" />
    </f:facet>
 </h:panelGrid>
</h:form>

What am I missing ?

Answer

I use a growl instead of a message for solving my problem.

Leave a Reply

Your email address will not be published. Required fields are marked *