webtier@glassfish.java.net

[jsf2]validator attribute, composite component. Unexpected exception.

From: <webtier_at_javadesktop.org>
Date: Thu, 20 May 2010 02:52:27 PDT

have composite component
xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:composite="http://java.sun.com/jsf/composite">

    <composite:interface>
        <composite:attribute name="inputVar"/>
        <composite:attribute name="validator"
                             method-signature="void f(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)"
                             targets="input"/>
        <composite:editableValueHolder name="input"/>
    </composite:interface>


    <composite:implementation>
        <h:inputText value="#{cc.attrs.inputVar}" id = "input"/>
        <h:message for = "#{cc.clientId}:input"/>
    </composite:implementation>

</html>


use next method as validator
@ManagedBean
@ApplicationScoped
public class Checker {
    public void validateF(FacesContext context, UIComponent component, Object value) throws ValidatorException{
        throw new ValidatorException(new FacesMessage("i'm invisible"));
    }
}


call component like this
<cu:inputText inputVar="hello" validator="#{checker.validateF}"/>


but validateF generate not "i'm invisible" exception. It generate this:
/index.xhtml @37,82 validator="#{checker.validateF}": The class 'useful.Checker' does not have the property 'validateF'.

after add property validateF to Checker

    public String getValidateF(){
        return "";
    }

and get proper exception "i'm invisible".

Is there solution to avoid adding of property?
[Message sent by forum member 'glich']

http://forums.java.net/jive/thread.jspa?messageID=470646