f:validateLength |
|
The ValidateLength tag registers a LengthValidator instance on the component
associated with the enclosing tag. This tag can be used to validate user input
when the expected value is a string of a specific length.
JSF Example
<!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head />
<body>
<h:form>
<h:outputLabel value="Enter your password: " for="password" />
<h:inputSecret label="Password" id="password" redisplay="true"
value="#{userController.user.password}">
<f:validateLength minimum="8" maximum="16" />
</h:inputSecret>
<h:commandButton value="Sign In" />
<h:message for="password" errorStyle="color:red; display:block" />
</h:form>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.
Rendered Output
|