| |||||||
FRAMES NO FRAMES |
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}>"
whereThe 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 Class | org.apache.myfaces.commons.validator.ValidateCompareToTag |
TagExtraInfo Class | None |
Body Content | empty |
Display Name | None |
Attributes | ||||
Name | Required | Request-time | Type | Description |
for | false | false | javax.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. |
forId | false | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| The JSF id of the component with which to compare values. |
operator | false | false | javax.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, <= |
comparator | false | false | javax.el.ValueExpression
(must evaluate to java.lang.Object )
| Value binding for an alternate java.util.Comparator object if component values don't implement Comparable |
alternateOperatorName | false | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| custom operator name in error message (ie "after" instead of "greater than" for dates) |
summaryMessage | false | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| alternate validation error summary message format string |
message | false | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) |
detailMessage | false | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) |
for | false | false | java.lang.String | {@inheritDoc} |
Variables | No Variables Defined. |
| |||||||
FRAMES NO FRAMES |