Myfaces Commons Validator Tag Library 2.0.
Tag validateCompareTo


Validates this component against another component.

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

Valid operator attribute values:

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

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:



Tag Information
Tag Classorg.apache.myfaces.commons.validator.ValidateCompareToTag
TagExtraInfo ClassNone
Body Contentempty
Display NameNone

Attributes
NameRequiredRequest-timeTypeDescription
forfalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)
The JSF id of the component with which to compare values. In JSF 2.0 facelets mode is used to identify the components this validator should be applied to when using composite components. Please use forId in that case instead.
forIdfalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)
The JSF id of the component with which to compare values.
operatorfalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)
Operator for comparison: equals: eq, ==, =, not equals: ne, !=, greater than: gt, >, less than: lt, <, greater than or equals: ge, >=, less than or equals: le, <=
comparatorfalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.Object)
Value binding for an alternate java.util.Comparator object if component values don't implement Comparable
alternateOperatorNamefalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)
custom operator name in error message (ie "after" instead of "greater than" for dates)
summaryMessagefalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)
alternate validation error summary message format string
messagefalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)
alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively)
detailMessagefalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)
alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively)
forfalsefalsejava.lang.String{@inheritDoc}

Variables
No Variables Defined.


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