<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.26.0">
</HEAD>
<BODY>
I've logged an issue for this:<BR>
<A HREF="https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1360">https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1360</A><BR>
<BR>
<BR>
When baseClass is:<BR>
class com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap<BR>
<BR>
BeanValidator.isResolvable(...) returns false because ExpressionEvalMap is a Map -- and never attempts to traverse the composite component.<BR>
<BR>
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.<BR>
<BR>
// case 1, base classes of Map, List, or Array are not resolvable<BR>
if (null != <B>baseClass</B>) {<BR>
if (<B>Map.class.isAssignableFrom(baseClass)</B> ||<BR>
Collection.class.isAssignableFrom(baseClass) ||<BR>
Array.class.isAssignableFrom(baseClass)) {<BR>
failureMessage = "<B>Unable to validate expression " + valueExpression.getExpressionString() +</B><BR>
<B> " using Bean Validation. Expression evaluates to a Map, List or array.";</B><BR>
result = false;<BR>
}<BR>
}<BR>
<BR>
<BR>
<B>This can be reproduced by using the following component, and an Object annotated with JSR303 annos.</B><BR>
Consuming page: (I've also tried "value" as the for="..." attribute value with no success)<BR>
<BR>
<BLOCKQUOTE>
<h:form><BR>
<BLOCKQUOTE>
<a:comp id="test" value="${bean.test.text}"><BR>
        <f:validateBean for="#{bean.test}"/><BR>
</a:comp><BR>
</BLOCKQUOTE>
</h:form><BR>
</BLOCKQUOTE>
<BR>
<B>Example component:</B><BR>
<BR>
<BLOCKQUOTE>
<html xmlns="<A HREF="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</A>"<BR>
        xmlns:h="<A HREF="http://java.sun.com/jsf/html">http://java.sun.com/jsf/html</A>"<BR>
        xmlns:f="<A HREF="http://java.sun.com/jsf/core">http://java.sun.com/jsf/core</A>"<BR>
        xmlns:a="<A HREF="http://java.sun.com/jsf/composite/ajax">http://java.sun.com/jsf/composite/ajax</A>"<BR>
        xmlns:ui="<A HREF="http://java.sun.com/jsf/facelets">http://java.sun.com/jsf/facelets</A>"<BR>
        xmlns:composite="<A HREF="http://java.sun.com/jsf/composite">http://java.sun.com/jsf/composite</A>"><BR>
<BR>
<composite:interface><BR>
        <composite:attribute name="value" required="true" type="Object" /><BR>
        <composite:editableValueHolder name="value" targets="value" /><BR>
</composite:interface><BR>
<BR>
<composite:implementation><BR>
        <h:message id="inputErr" for="input"/><br/><BR>
        <h:inputText id="input" value="#{cc.attrs.value}" ><BR>
                <f:ajax execute="@this" render="@this inputErr" /><BR>
        </h:inputText><BR>
</composite:implementation><BR>
<BR>
</html><BR>
</BLOCKQUOTE>
<BR>
<B>Example Object:</B><BR>
<BR>
<BLOCKQUOTE>
public class ValidationCriteria<BR>
{<BR>
@Size(min=4, max=255)<BR>
private String text;<BR>
<BR>
public String getText()<BR>
{<BR>
return text;<BR>
}<BR>
<BR>
public void setText(final String validation)<BR>
{<BR>
this.text = validation;<BR>
}<BR>
}<BR>
<BR>
</BLOCKQUOTE>
ExampleBean<BR>
<BR>
@ManagedBean<BR>
public class Bean<BR>
{<BR>
private ValidationCriteria test = new ValidationCriteria();<BR>
<BR>
public ValidationCriteria getTest()<BR>
{<BR>
return test;<BR>
}<BR>
}<BR>
<BR>
<BR>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
--<BR>
<B>Lincoln Baxter, III</B><BR>
Co-Founder of <A HREF="http://ocpsoft.com">OcpSoft</A><BR>
<BR>
Creator of:<BR>
<A HREF="http://ocpsoft.com/prettyfaces">PrettyFaces</A>: URL rewriting for JSF<BR>
<A HREF="http://ocpsoft.com/prettytime">PrettyTime</A>: Java elapsed timestamp formatting<BR>
<BR>
<BR>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>