f:event preValidate - automatic readout question

From: <>
Date: Sun, 17 Oct 2010 23:01:20 +0200 (CEST)


I am quite new to JSF and have a question about the automatic readout of a ComponentSystemEvent by a preValidation-Method.

    public void preValidate( ComponentSystemEvent evt )
        UIForm form = (UIForm) evt.getComponent();
        for ( int i = 0; i < beanFields.length; i++ )

            String c_name = beanFields[i].getName();
            UIComponent componente = findComponentRecursive( form, c_name );

The fields in the bean must have the same name as the id of the component. The own method findComponentRecursive() uses findComponent() to find the component recursively. The method calls itself if the actual component is not the right one and has children.
The JSF-form is build up of some composite components and there my problem occurs. If there are to many CCs interlaced the component cannot be found.

The form works, the values inserted pass the JSF-validator and are saved to the bean, but my validator is not called.

Some more information about the JSF code:

    index.xhtml > form.xhtml
    index.xhtml > inputText.xhtml > layout.xhtml > label.xhtml


    <html xmlns=""
        <form:form id="validatorTest" vali="#{testValidator}">
            <form:inputText ident="einString" beanField="#{testBean.einString}" />


        <composite:attribute name="ident" default="form" />
        <composite:attribute name="vali" shortDescription="validator used i.e. #{myValidator}" />
        <h:form id="#{cc.attrs.ident}">
            <f:event type="preValidate" listener="#{cc.attrs.vali.preValidate}" />
            <composite:insertChildren />



        <composite:attribute name="ident" required="true" />
        <composite:attribute name="beanField" required="true" shortDescription="the bean-var, i.e. #{myBean.myVar}" />
        <composite:attribute name="label" shortDescription="label for this input field" />
            <h:inputText id="#{cc.attrs.ident}" value="#{cc.attrs.beanField}" />


        <h:panelGrid columns="4" columnClasses="form_tableLabel,form_tableInput">
            <st:label ident="#{cc.parent.attrs.ident}" label="#{cc.parent.attrs.label}" />
            <composite:insertChildren />

label.xhtml only displays the label for the input field.

The component is rendered with an id like "validatorTest:form:j_idt47:j_idt48:einString" where j_idt47 is the inputText-composite and j_idt48 is the layout-composite. if I put the <h:inputText> field directly into <composite:implementation> of inputText.xhtml, the part "j_idt48" is gone an the preValidation works.
In my recursive method the component with the ID "j_idt48" has no children an is a NamingContainer.
I tried to use a facet instead of composite:insertChildren in layout.xhtml but it was the same result.

Is there a (better) way to find all input fields of the form submitting the ComponentSystemEvent to my method?

Can anyone help me with that?

I'm using the Mojarra 2.0.3 FCS jsf-libs in a Tomcat 6.0.29, JRE-sun Eclipse Helios

WEB.DE DSL Doppel-Flat ab 19,99 &euro;/mtl.! Jetzt auch mit
gratis Notebook-Flat!