HTML and CSS Reference
In-Depth Information
<h:outputText value="#{bundle['user.email']}"></h:outputText>
<h:inputText id="email"
value="#{person.email}"
required="true"
requiredMessage="#{bundle['user.email.required']}">
<f:validateBean
validationGroups="com.jsfprohtml5.subscriber.bean.validation.groups.LengthGroup,
com.jsfprohtml5.subscriber.bean.validation.groups.EmailGroup"/>
</h:inputText>
<h:message for="email" styleClass="errorMessage"/>
</h:panelGrid>
<h:commandButton value="#{bundle['application.subscribe']}"
action="#{person.subscribe}">
</h:commandButton>
<br/>
<h:messages styleClass="errorMessage"/>
</h:form>
</ui:define>
</ui:composition>
</html>
As shown in the bolded lines, the <f:validateBean> tag can be attached to EditableValueHolder s, and using the
validationGroups attribute, you can specify the fully qualified name of the constraint classes (separated by commas)
which you want to execute on the parent EditableValueHolder .
the complete Maven project of the subscriber application is included in the topic web page at apress.com
under Chapter 3 resources.
Note
Overriding Standard Messages
It is always useful to override the standard conversion and validation error messages in order to have a better
user experience. Although you can customize the conversion and validation error messages by using the
validatorMessage , requiredMessage , and converterMessage attributes of the EditableValueHolder components,
it will require less effort and more accuracy to globally override the JSF standard conversion and validation messages
on the application level than on every EditableValueHolder component.
In order to globally override the JSF standard conversion and validation messages, you will have to override the
messages in your application message bundle by using the standard message keys. Table 3-3 shows the possible JSF
standard message keys according to the JSF specification.
 
 
Search WWH ::




Custom Search