0

I'm observing the following behavior within a JSF 2 page (Mojarra 2.1.18 / RedHat EAP 6.1, if that's useful). I've got a form wrapping a data table, and I'm supplying an ID attribute value for both the form and the table. When I view the resulting html source file, I see that the table ID is set to an auto-generated value and the form ID attribute is not prepended to the auto-generated table ID. That is:

This set of tags:

<h:form id="form4">
   <h:datatable id="notices" ...>
    ...
   </h:datatable>
</h:form>    

Yields the following html:

<form id="form4" ...>
   <table id="j_itd68"> //i.e. id != "notices"
   ...
   </table>
</form>

There are more elements in the JSF xhtml file preceding the h:form/h:datatable, but I've intentionally excluded them here (hoping that someone might recognize this symptom without additional clutter). Things go wrong for me when I attempt to include some PrimeFaces p:commandbutton instances within the table. They don't get named properly (i.e. they don't include the enclosing form ID in the generated ID), and this causes a "component not found for ID" servlet error. The same improper naming occurs if I replace the p:commandbutton instances with h:commandbutton instances (so I don't believe this is a PrimeFaces issue). This behavior seems like the result of a malformed JSF page, but I haven't found anything yet (a NetBeans XML check on the JSF xhtml file returns a successful result). Any help is appreciated.

Best regards,

-Andy

Andrew David
  • 81
  • 1
  • 5
  • OK, so I figured it out. I left out an important detail - I was binding a datatable component to the id="notices" h:datatable i.e. ` – Andrew David Jun 17 '14 at 01:29
  • possible duplicate of [How to reference components in JSF ajax? Cannot find component with identifier "foo" in view](http://stackoverflow.com/questions/8634156/how-to-reference-components-in-jsf-ajax-cannot-find-component-with-identifier) – perissf Jun 17 '14 at 07:37
  • @perissf - I don't agree that this is a duplicate question. I had reviewed the thread you cited before posting my question and it didn't seem related to my specific error. My error was caused by improper overloading of a bound component on a backing bean in the session scope and that translated into a rejection of the supplied value for the datatable's id attribute. This seems like a different problem/solution vs. the possible duplicate question you provide. – Andrew David Jun 18 '14 at 00:11

0 Answers0