View RSS Feed

JSF

Built-in JSF validation components

Rate this Entry
by
JSF
, 07-07-2012 at 05:00 PM (1464 Views)
JSF reference implementation of SUN gives certain defaulting validation components which are leveraged so that user input validation could be implemented. Core library of JSF provides tags so that input could be validated. Few tags are given here which are used for validation of the input.

  • f:validateDoubleRange: Component value is checked by this tag, within range. It is necessary for value to be convertiable to floating point or floating point type.


  • f:validateLength: Value length is checked by this tag which makes it restricted in a specific range. Type of value shall be java.lang.String.


  • f:validateLongRange: Component value is checked in specific range. Value shall be numeric or string which is convertible to long.


XML Code:
<h:inputText id="Username" value="#{UserBean.userName}">
    <f:validateLength minimum="6" maximum="15"/>
</h:inputText>
....
<h:inputText id="Age" value="#{UserBean.age}">
    <f:validateLongRange minimum="1" maximum="120"/>
</h:inputText>

Submit "Built-in JSF validation components" to Facebook Submit "Built-in JSF validation components" to Digg Submit "Built-in JSF validation components" to del.icio.us Submit "Built-in JSF validation components" to StumbleUpon Submit "Built-in JSF validation components" to Google

Comments