1 Reply Latest reply on Aug 12, 2010 3:48 AM by liuliu

    Writing reusable JSF / richfaces  / a4j

    altoo2

      Hi,

       

      i am using richfaces 3.3.3.Final , and i am having troubles with reusable code.
      I want one piece mupliple included in a page with <ui:include/>.

       

      I am having troubles with duplicate component IDs with including that file more than once. i found a solution but i am looking for a better solution.

       


      // including page
      <ui:include src="anyTable.xhtml"/>
      <ui:include src="anyTable.xhtml"/>

       

       

       

      // content of included file "anyTable.xhtml":
      <rich:dataTable id="mytable">
        ...
      <ajax:support reRender="" />
      ...
      </rich:dataTable>

       


      ui:repeat does not work properly, it puts an ID prefix , but IDs are messed up and are not properly assigned.

       

      <ui:repeat var="x" value="#{1}"> <ui:include src="anyTable.xhtml"/> </ui:repeat>
      <ui:repeat var="x" value="#{1}"> <ui:include src="anyTable.xhtml"/> </ui:repeat>

       

      Like this generates correct looking output, but IDs are messed up (they are crosslinked somehow).

       

       

       

      rich:dataTable does not mess up with Ajax / component IDs
      so e.g. this solution (ajax) works with rich:dataTable :


        <rich:dataTable var="x" value="#{1}"> <rich:column>
            <ui:include src="anyTable.xhtml"/>
        </rich:column></rich:dataTable>
        <rich:dataTable var="x" value="#{1}"> <rich:column>
            <ui:include src="anyTable.xhtml"/>
        </rich:column></rich:dataTable>

       

       

       

      But i would like a better solution for making ajax namespaces / local ID prefixes, is there a solution for this?

       

       

       

      Rgs
      Alvo