I've logged an issue for this:
https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1360


When baseClass is:
    class com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap

BeanValidator.isResolvable(...) returns false because ExpressionEvalMap is a Map -- and never attempts to traverse the composite component.

This is a big problem with Bean Validation support, since probably the most attractive feature of JSF2 is composite components, and this means BeanValidation will not function at all within any composite components.

            // case 1, base classes of Map, List, or Array are not resolvable
            if (null != baseClass) {
                if (Map.class.isAssignableFrom(baseClass) ||
                        Collection.class.isAssignableFrom(baseClass) ||
                        Array.class.isAssignableFrom(baseClass)) {
                    failureMessage = "Unable to validate expression " + valueExpression.getExpressionString() +
                            " using Bean Validation.  Expression evaluates to a Map, List or array.";
                    result = false;
                }
            }


This can be reproduced by using the following component, and an Object annotated with JSR303 annos.
Consuming page: (I've also tried "value" as the for="..." attribute value with no success)

<h:form>
<a:comp id="test" value="${bean.test.text}">
<f:validateBean for="#{bean.test}"/>
</a:comp>
</h:form>

Example component:

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a="http://java.sun.com/jsf/composite/ajax"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:composite="http://java.sun.com/jsf/composite">

<composite:interface>
<composite:attribute name="value" required="true" type="Object" />
<composite:editableValueHolder name="value" targets="value" />
</composite:interface>

<composite:implementation>
<h:message id="inputErr" for="input"/><br/>
<h:inputText id="input" value="#{cc.attrs.value}" >
<f:ajax execute="@this" render="@this inputErr" />
</h:inputText>
</composite:implementation>

</html>

Example Object:

public class ValidationCriteria
{
    @Size(min=4, max=255)
    private String text;

    public String getText()
    {
        return text;
    }

    public void setText(final String validation)
    {
        this.text = validation;
    }
}

ExampleBean

@ManagedBean
public class Bean
{
    private ValidationCriteria test = new ValidationCriteria();

    public ValidationCriteria getTest()
    {
        return test;
    }
}



--
Lincoln Baxter, III
Co-Founder of OcpSoft

Creator of:
PrettyFaces: URL rewriting for JSF
PrettyTime: Java elapsed timestamp formatting