Time for action – displaying FacesMessage with HTML content
Let us see how to use the escape
attribute, while displaying FacesMessages
with HTML content. Perform the following steps:
- Create a form with two input fields as follows:
<h:form id="form1" style="width: 500px; padding-left: 10px;"> <p:panel header="Messages with HTML content - Using 'escape' attribute"> <h:panelGrid columns="3"> <h:outputText value="FirstName" /> <p:inputText id="fName" value="#{messagesController.user.firstName}"/> <p:message for="fName" escape="false" /> <h:outputText value="LastName" /> <p:inputText id="lName" value="#{messagesController.user.lastName}"/> <p:message for="lName" escape="true" /> <p:commandButton value="Submit" actionListener="...