1 Reply Latest reply on Mar 18, 2008 2:29 PM by freemarket

    ui:include generates fictional dynamic ids

    ffreemarket

      Hi,

      ui:include is generating a dynamic id path that does not exist lexically in the .xhtml files possibly causing duplicate display of HTML form elements on rendered page. Environment is partial page navigation using a4j:include and enclosed ui:include.

      Form elements were checked using Firebug under FF 2.0 and verified within a4j:log.

      I have following (excerpted):

      <h:form id="mainform">
      .
      .
      <a4j:include layout="block" id="insertedPage" viewId="#{componentNavigator.viewId}" binding="#{componentNavigator.include}"/>
      
      </h:form>


      Where a dynamically included page is of the form:

      <ui:composition>
      .
      .
       <ui:include src="panels/output/subcomponentPanel.xhtml">
       <ui:param name="inout" value="out_" />
       </ui:include>
      
      .
      .
      </ui:composition>


      with the subcomponentPanel.xhtml also including another .xhtml:

      <a4j:repeat id="#{inout}subcomprows" rows="#{searchCompositeBean.numSub}" binding="#{reqcomp.repeater}" rowKeyVar="rowKey" ajaxKeys="#{reqcomp.rowsToUpdate}"
       value="#{searchCompositeBean.cbe}" var="item">
       <ui:include src="/includes/panels/output/subcomp.xhtml">
       <ui:param name="inout" value="${inout}" />
       <ui:param name="instnum" value="${rowKey}"/>
       </ui:include>
       </a4j:repeat>


      and finally subcomp.xhtml:

      <td><h:inputText id="#{inout}subcomp#{instnum}" value="#{searchCompositeBean.cbe[instnum].name}" immediate="true" valueChangeListener="#{searchCompositeBean.subcompChanged}"/>
       <rich:message for="#{inout}subcomp#{instnum}"/></td>
      .
      .
      .


      The idea is to decompose into logical pieces and to reuse components for input/display forms. When I have an input form - ie. when inout = "in_", I expect to see tags that only look like:

      id="mainform:insertedPage:in_subcomprows:0:in_subcomp

      All the "in" should match and when on a display form, all the "out" should match. After usage of the input form to save a record or the search form to retrieve a record, return to the other form via partial page navigation displays additional form elements which are of the form:

      mainform:insertedPage:out_subcomprows:0:in_subcomp

      implying that the ajax call has assembled a mix of the out subcomponentpanel.xhtml with the in subcomp.xhtml. The a4j:log confirms this as well:

      id="mainform:insertedPage:out_subcomprows:0:in_subcomp" type="text" name="mainform:insertedPage:out_subcomprows:0:in_subcomp" value="subcomp1" />


      I am using the following jars for this project:

      -rw-r--r-- 1 root root 56290 2008-03-17 17:45 activation.jar
      -rw-r--r-- 1 root root 168760 2008-03-17 17:45 commons-beanutils-core.jar
      -rw-r--r-- 1 root root 571259 2008-03-17 17:46 commons-collections-3.2.jar
      -rw-r--r-- 1 root root 121757 2008-03-17 17:45 commons-dbcp-1.2.2.jar
      -rw-r--r-- 1 root root 143602 2008-03-17 17:46 commons-digester-1.8.jar
      -rw-r--r-- 1 root root 52915 2008-03-17 17:46 commons-logging-1.1.jar
      -rw-r--r-- 1 root root 62103 2008-03-17 17:46 commons-pool-1.3.jar
      -rw-r--r-- 1 root root 85587 2008-03-17 17:46 ibatis-common-2.jar
      -rw-r--r-- 1 root root 61191 2008-03-17 17:46 ibatis-dao-2.jar
      -rw-r--r-- 1 root root 322368 2008-03-17 17:46 ibatis-sqlmap-2.jar
      -rw-r--r-- 1 root root 93310 2008-02-05 12:56 jhighlight-1.0.jar
      -rw-r--r-- 1 root root 323012 2008-03-17 17:46 jsf-api-1.2_04-p02.jar
      -rw-r--r-- 1 root root 300600 2008-03-17 17:46 jsf-facelets.jar
      -rw-r--r-- 1 root root 1210046 2008-03-17 17:46 jsf-impl-1.2_04-p02.jar
      -rw-r--r-- 1 root root 391834 2008-03-17 17:46 log4j-1.2.15.jar
      -rw-r--r-- 1 root root 371264 2008-03-17 17:46 mail.jar
      -rw-r--r-- 1 root root 105672 2008-02-05 12:56 nekohtml-0.9.5.jar
      -rw-r--r-- 1 root root 1536554 2008-03-17 17:46 ojdbc14.jar
      -rw-r--r-- 1 root root 2073 2008-02-06 23:17 phaseTracker.jar
      -rw-r--r-- 1 root root 124299 2008-03-17 17:45 richfaces-api-3.2.0-SNAPSHOT.jar
      -rw-r--r-- 1 root root 1192850 2008-03-17 17:46 richfaces-impl-3.2.0-SNAPSHOT.jar
      -rw-r--r-- 1 root root 1631869 2008-03-17 17:46 richfaces-ui-3.2.0-SNAPSHOT.jar
      -rw-r--r-- 1 root root 895924 2008-02-05 12:56 xercesImpl-2.4.0.jar
      


      where facelets is 1.1.3.

      Any suggestions for how to eliminate the duplicate elements?
      I suspect the a4j:repeat element is the culprit as the same input/output paradigm is used in the form for the other panels yet only the panel with the a4j:repeat iteration element is duplicating form elements.

      Regards,
      Henry