HTML and CSS Reference
In-Depth Information
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
JSF—by default—executes the constraints which are grouped under the Default validation group. In order to
run specific validation groups on the EditableValueHolder s, JSF provides a <f:validateBean> tag that can be used
to select which validation groups are to be executed on the parent EditableValueHolder . This feature really gives a
great control on the level of the input field validation. Listing 3-20 shows an updated index.xhtml of the subscriber
application.
Listing 3-20. Updated index.xhtml Page
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns=" http://www.w3.org/1999/xhtml "
xmlns:ui=" http://java.sun.com/jsf/facelets "
xmlns:h=" http://java.sun.com/jsf/html "
xmlns:f=" http://java.sun.com/jsf/core " >
<ui:composition template="/WEB-INF/templates/default.xhtml">
<ui:define name="title">
#{bundle['application.subscriber.title']}
</ui:define>
<ui:define name="content">
<h:form>
<h:panelGrid columns="3">
<h:outputText value="#{bundle['user.name']}"></h:outputText>
<h:inputText id="userName"
value="#{person.name}"
required="true"
requiredMessage="#{bundle['user.name.required']}">
<f:validateBean
validationGroups="com.jsfprohtml5.subscriber.bean.validation.groups.LengthGroup"/>
</h:inputText>
<h:message for="userName" styleClass="errorMessage"/>
<h:outputText value="#{bundle['user.address']}"></h:outputText>
<h:inputText id="address"
value="#{person.address}"
required="true"
requiredMessage="#{bundle['user.address.required']}">
<f:validateBean
validationGroups="com.jsfprohtml5.subscriber.bean.validation.groups.LengthGroup"/>
</h:inputText>
<h:message for="address" styleClass="errorMessage"/>
 
Search WWH ::




Custom Search