Myfaces Commons Validator Tag Library 2.0.


Standard Syntax:
     <%@ taglib prefix="mcv" uri="http://myfaces.apache.org/commons/validators" %>

XML Syntax:
     <anyxmlelement xmlns:mcv="http://myfaces.apache.org/commons/validators" />

MyFaces subproject that contains validator to be used with any JSF 2.0
                                    implementation.

Tag Library Information
Display NameMyfaces Commons Validator Tag Library 2.0.
Version1.1.7
Short Namemcv
URIhttp://myfaces.apache.org/commons/validators
 

Tag Summary
validateCSVValidation by validating comma separated values individually.
validateCompareToValidates this component against another component.

Specify the foreign component with the for={foreign-component-id} attribute.

Valid operator attribute values:

  • equals: eq, ==, =,
  • not equals: ne, !=,
  • greater than: gt, >,
  • less than: lt, <,
  • greater than or equals: ge, >=,
  • less than or equals: le, <=

If the comparator attribute is specified, the component values are compared using the specified java.util.Comparator object. If no comparator is specified, the component values must implement Comparable and are compared using compareTo(). If either value or foreign value does not implement Comparable and no Comparator is specified, validation always succeeds.

Put this validator on the bottom-most component to insure that the foreign component's value has been converted and validated first.

However, this validator will attempt to convert and validate the foreign component's value if this has not already occurred. This process may not be identical to the standard JSF conversion and validation process.

The validation error message key is currently hardcoded as

"{0} value <{1}> must be {2} {3} value <{4}>"

where
  • {0} is the parent component id,
  • {1} is the parent component value,
  • {2} is the operator name,
  • {3} is the foreign component id, and
  • {4} is the foreign component value.

The alternateOperatorName attribute can specify a custom operator name. For example, use "after" instead of "greater than" when comparing dates. The message attribute can specify an alternate validation error message key. For example, use "{0} must be {2} {3}" to remove values from the message.

Known issues:

  • Operator names should be localized.
  • The default message key should be localized.
  • Perhaps an exception should be thrown if the two values are not Comparable and no Comparator is specified.
validateCreditCardA custom validator for creditCards, based upon Jakarta Commons. Unless otherwise specified, all attributes accept static values or EL expressions
validateDateRestrictionValidate that the date entered is within a given restriction.
validateRegExprA custom validator for reg. expr., based upons Jakarta Commons. Unless otherwise specified, all attributes accept static values or EL expressions.
validateUrlA custom validator for url format, based upons Jakarta Commons.
validateEmailA custom validator for email address format, based upons Jakarta Commons. Unless otherwise specified, all attributes accept static values or EL expressions.
validateISBNA custom validator for isbn codes, based upons Jakarta Commons.
 


Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-3 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.