Apache MyFaces
Documentation
Foundation

Tag reference sheet

Tag library reference for the following tag libraries:

Myfaces Commons Validator Tag Library 1.2.

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

This is version 1.1.7.

Required attributes are marked with a *

<mcv:validateCSV>

Validation by validating comma separated values individually.

Can contain: empty

Attributes

Name Description Type
detailMessage alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
message alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
separator String
subvalidatorId String
summaryMessage alternate validation error summary message format string String

<mcv:validateCompareTo>

Validates this component against another component. <p> Specify the foreign component with the for={foreign-component-id} attribute. </p> <p> Valid operator attribute values: </p> <ul> <li>equals: eq, ==, =,</li> <li>not equals: ne, !=,</li> <li>greater than: gt, &gt;,</li> <li>less than: lt, &lt;,</li> <li>greater than or equals: ge, &gt;=,</li> <li>less than or equals: le, &lt;=</li> </ul> <p> 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. </p> <p> Put this validator on the bottom-most component to insure that the foreign component's value has been converted and validated first. </p> <p> 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. </p><p> The validation error message key is currently hardcoded as </p> <p> "{0} value &lt;{1}&gt; must be {2} {3} value &lt;{4}&gt;" </p> where <ul> <li>{0} is the parent component id,</li> <li>{1} is the parent component value,</li> <li>{2} is the operator name,</li> <li>{3} is the foreign component id, and</li> <li>{4} is the foreign component value.</li> </ul> <p> 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. </p> <p> Known issues: </p> <ul> <li> Operator names should be localized.</li> <li> The default message key should be localized.</li> <li> Perhaps an exception should be thrown if the two values are not Comparable and no Comparator is specified.</li> </ul>

Can contain: empty

Attributes

Name Description Type
alternateOperatorName custom operator name in error message (ie "after" instead of "greater than" for dates) String
comparator Value binding for an alternate java.util.Comparator object if component values don't implement Comparable String
detailMessage alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
for The JSF id of the component with which to compare values. String
message alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
operator Operator for comparison: equals: eq, ==, =, not equals: ne, !=, greater than: gt, &gt;, less than: lt, &lt;, greater than or equals: ge, &gt;=, less than or equals: le, &lt;= String
summaryMessage alternate validation error summary message format string String

<mcv:validateCreditCard>

A custom validator for creditCards, based upon Jakarta Commons. Unless otherwise specified, all attributes accept static values or EL expressions

Can contain: empty

Attributes

Name Description Type
amex american express cards String
detailMessage alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
discover validation for discover String
mastercard validation for mastercard String
message alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
none none of the given cardtypes is allowed. String
summaryMessage alternate validation error summary message format string String
visa validation for visa String

<mcv:validateDateRestriction>

Validate that the date entered is within a given restriction.

Can contain: empty

Attributes

Name Description Type
detailMessage alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
invalidDays To specifiy a concrete List of Dates, use the invalidDays attribute and wire it to a DateListProvider implementation. This returns a list of dates, which are invalid. String
invalidDaysOfWeek Specify the weekdays which are invalid for your use case. The attribute takes whitespace delimited list of weekdays. Possible values are sun, mon, tue, wed, thu, fri, sat. String
invalidMonths Specify the month which are invalid for your use case. The attribute takes a whitespace delimited list of months. Possible values are jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec. String
message alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
summaryMessage alternate validation error summary message format string String

<mcv:validateEmail>

A custom validator for email address format, based upons Jakarta Commons. Unless otherwise specified, all attributes accept static values or EL expressions.

Can contain: empty

Attributes

Name Description Type
detailMessage alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
message alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
summaryMessage alternate validation error summary message format string String

<mcv:validateISBN>

A custom validator for isbn codes, based upons Jakarta Commons.

Can contain: empty

Attributes

Name Description Type
detailMessage alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
message alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
summaryMessage alternate validation error summary message format string String

<mcv:validateRegExpr>

A custom validator for reg. expr., based upons Jakarta Commons. Unless otherwise specified, all attributes accept static values or EL expressions.

Can contain: empty

Attributes

Name Description Type
detailMessage alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
message alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
pattern the pattern, which is the base of the validation String
summaryMessage alternate validation error summary message format string String

<mcv:validateUrl>

A custom validator for url format, based upons Jakarta Commons.

Can contain: empty

Attributes

Name Description Type
allow2Slashes Allow two slashes in the path component of the URL. String
allowAllSchemas Allows all validly formatted schemes to pass validation instead of supplying a set of valid schemes. String
detailMessage alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
message alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively) String
schemes CSV values that indicates the set of schemes to check this url. If allowAllSchemas = true, the values of this field are ignored. If no schemes are provided, default to this set ("http", "https", "ftp"). String
summaryMessage alternate validation error summary message format string String