I wrote a .xhtml page to test the compatibility of some components:
- h:commandButton
- p:commandButton
- a4j:commandButton
- h:message
- h:messages
- rich:message
- rich:messages
- p:growl
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:s="http://jboss.com/products/seam/taglib"> <head> <p:resources/> </head> <body> <hr/> Messages: <h:panelGroup id="pgMessages"><h:messages id="messages"/></h:panelGroup> <hr/> RichMessages: <rich:messages id="richMessages"/> <hr/> <a4j:outputPanel ajaxRendered="true"> <p:growl id="growl" showDetail="true" showSummary="true" sticky="false" rendered="true"/> </a4j:outputPanel> <hr/> <h:form id="form"> <p> <h:outputText value="Enter Name: " /> <h:inputText id="name" value="#{growlTestBean.name}" required="true"/><br/> Message: <h:panelGroup id="pgMessage"><h:message id="message" for="name"/></h:panelGroup><br/> RichMessage: <rich:message id="richMessage" for="name"/><br/> </p> <p> With h:commandButton everything is updated automatically.<br/> <h:commandButton value="Test" action="#{growlTestBean.testGrowl}"/> </p> <p> With p:commandButton, nothing is updated automatically.<br/> You must specify the components to update by listing their id's in the 'update' attribute.<br/> It doesn't update h:messages, even if you list its id in the 'update' attribute. <br/> To update h:messages, you must put a 'h:panelGroup' element around it and list the id of the panelGroup.<br/> It doesn't update h:message, even if you list its id in the 'update' attribute. <br/> To update h:message, you must put a 'h:panelGroup' element around it and list the id of the panelGroup.<br/> <p:commandButton value="Test" action="#{growlTestBean.testGrowl}" update="pgMessages,pgMessage,richMessage,richMessages,growl"/> </p> <p> With a4j:commandButton, only 'rich:messages' and 'rich:message' will be updated automatically.<br/> To update h:messages, you must list its id in the 'reRender' attribute.<br/> To update h:message, you must list its id in the 'reRender' attribute.<br/> To update p:growl, you must put it in an 'a4j:outputPanel' with ajaxRendered="true".<br/> <a4j:commandButton value="Test" action="#{growlTestBean.testGrowl}" reRender="pgMessages,pgMessage,growl"/> </p> </h:form> </body> </html>