Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-1770

components inside c:forEach has wrong id generation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.2.2
    • JSR-252
    • None
    • jetty 6.1.3, myfaces 1.2.1-SNAPSHOT, jstl 1.2

    Description

      Using jsp pages I have made simple example to test if unified EL works and if I can mix jstl 1.2 tags with myfaces 1.2 components on
      the same page, one of the behaviors that promotes jsf 1.2.

      The test is this:

      public class ListBean
      {

      Log log = LogFactory.getLog(ListBean.class);

      public ListBean(){

      }

      public List getStringList()

      { List list = new ArrayList(); list.add("A"); list.add("B"); list.add("C"); list.add("D"); return list; }

      }

      page:

      <h:form id="form">
      <c:forEach var="item" items="#

      {listBean.stringList}">
       <h:inputText value="#{item}" />
      <br>
      </c:forEach>
      </h:form>

      and that's all.

      On myfaces I have the following output:

       
      <input id="form:j_id_id28" name="form:j_id_id28" type="text" value="A" />

       


       


       

      <input id="form:j_id_id28j_id_0" name="form:j_id_id28j_id_0" type="text" value="B" />


      and on the log:

      Nov 18, 2007 7:06:09 PM org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory getLifecycleProvider
      INFO: Using LifecycleProvider org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider
      Nov 18, 2007 7:06:09 PM javax.faces.webapp.UIComponentClassicTagBase findComponent
      WARNING: There is more than one JSF tag with an id : j_id_id28j_id_0
      Nov 18, 2007 7:06:09 PM javax.faces.webapp.UIComponentClassicTagBase findComponent
      WARNING: There is more than one JSF tag with an id : j_id_id28j_id_0
      Nov 18, 2007 7:06:37 PM javax.faces.webapp.UIComponentClassicTagBase findComponent
      WARNING: There is more than one JSF tag with an id : j_id_id28j_id_0
      Nov 18, 2007 7:06:37 PM javax.faces.webapp.UIComponentClassicTagBase findComponent

      if I assign a custom id for h:inputText throws an error of duplicateId

      Using jsf ri 1.2_05 I have the following output:

       
      <input type="text" name="form:j_id_id28" value="A" />

       
      <input type="text" name="form:j_id_id28j_id_1" value="B" />


       
      <input type="text" name="form:j_id_id28j_id_2" value="C" />

       
      <input type="text" name="form:j_id_id28j_id_3" value="D" />

      This is that I expected. With this code:

      <c:forEach var="item" items="#{listBean.stringList}

      ">
       
      <h:inputText id="item" value="#

      {item}

      " />
      </c:forEach>

      Render this:

       
      <input id="form:item" type="text" name="form:item" value="A" />

       
      <input id="form:itemj_id_1" type="text" name="form:itemj_id_1" value="B" />

       
      <input id="form:itemj_id_2" type="text" name="form:itemj_id_2" value="C" />

       
      <input id="form:itemj_id_3" type="text" name="form:itemj_id_3" value="D" />

      This is correct!.

      I have made a probe with tomcat 6.0.14 and do the same as jetty.

      Attachments

        1. patchWrongIdJstlAndCustomId.patch
          2 kB
          Leonardo Uribe

        Activity

          People

            lu4242 Leonardo Uribe
            lu4242 Leonardo Uribe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: