Posted by nanoinverno
on October 18, 2010 at 3:00 AM PDT
I am quite new to JSF and have a question about the automatic readout of a ComponentSystemEvent by a preValidation-Method. I'm not sure if this forum is the right one for this problem but maybe someone can help me :)
public void preValidate( ComponentSystemEvent evt )<br />
UIForm form = (UIForm) evt.getComponent();<br />
for ( int i = 0; i < beanFields.length; i++ )<br />
<p> String c_name = beanFields.getName();<br />
UIComponent componente = findComponentRecursive( form, c_name );</p>
<p> ...<br />
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
<p> ...<br />
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 field directly into 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]I'm using the Mojarra 2.0.3 FCS jsf-libs in a Tomcat 6.0.29, JRE-sun 18.104.22.168. Eclipse Helios