Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3
    • Component/s: Components/Renderers
    • Labels:
      None

      Description

      I encountered a problem attempting to set the ui:repeat "value" attribute to an
      instance that was a subclass of java.util.Set (specifically Hibernate's
      PersistentSet class): the UIRepeat class treated it like a scalar object.

      An iteration tag like ui:repeat should work with all Collection types in my
      opinion. In the UIRepeat.getDataModel() method it's possible to detect an
      instance of Collection and make use of the ArrayDataModel by invoking the
      toArray() method on the instance. In this way a new DataModel implementation
      isn't needed. I've made this change in my own copy of Facelets and it works
      beautifully.

      Hibernate happens to use Sets quite a bit, so this was important to me. I'd be
      happy to submit a patch.

      This issue occurs in Facelets 1.2 as well.\

        Issue Links

          Activity

          Hide
          Aditya added a comment -

          Not only just collections, ui:repeat should also support iterables as well for the value attribute.

          Show
          Aditya added a comment - Not only just collections, ui:repeat should also support iterables as well for the value attribute.
          Hide
          Ertio lew added a comment -

          ui:repeat should allow iterables to be used with them. Currently we are required to create a new list from iterable just to support ui:repeat. This limitation should be removed.

          Show
          Ertio lew added a comment - ui:repeat should allow iterables to be used with them. Currently we are required to create a new list from iterable just to support ui:repeat. This limitation should be removed.
          Hide
          kithouna added a comment -

          The collection / iterable to datamodel conversion should be abstracted and put in a global place. Now DataTable and UIRepeat do pretty much the same thing and differences crop up between them that benefit no one.

          Then, we the users should be able to register additional datamodel converters, so we can register something like OmniFaces' IterableDataModel and they would be automatically used by DataTable, UIRepeat and others.

          Show
          kithouna added a comment - The collection / iterable to datamodel conversion should be abstracted and put in a global place. Now DataTable and UIRepeat do pretty much the same thing and differences crop up between them that benefit no one. Then, we the users should be able to register additional datamodel converters, so we can register something like OmniFaces' IterableDataModel and they would be automatically used by DataTable, UIRepeat and others.
          Hide
          Ed Burns added a comment -

          Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

          Show
          Ed Burns added a comment - Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.
          Hide
          Manfred Riem added a comment -

          Setting priority to Major

          Show
          Manfred Riem added a comment - Setting priority to Major
          Hide
          arjan tijms added a comment -

          Not only just collections, ui:repeat should also support iterables as well for the value attribute.

          I agree, and have adjusted the title of the issue to reflect that. If UIRepeat supports iterables, UIData should support that as well. Thanks for this suggestion!

          Show
          arjan tijms added a comment - Not only just collections, ui:repeat should also support iterables as well for the value attribute. I agree, and have adjusted the title of the issue to reflect that. If UIRepeat supports iterables, UIData should support that as well. Thanks for this suggestion!
          Hide
          Ed Burns added a comment -

          Section 4.1.3.2 in the spec PDF must be updated as well for this issue to be considered closed. The relevant text in the latest version of the spec is the following:

          The current value identified by the value property is normally of type DataModel. [P1-start-uidataModel]However, a
          DataModel wrapper instance must automatically be provided by the JSF implementation if the current value is of one
          of the following types:
          java.util.List
          Array of java.util.Object
          java.sql.ResultSet (which therefore also supports javax.sql.RowSet)
          javax.servlet.jsp.jstl.sql.Result
          Any other Java object is wrapped by a DataModel instance with a single row.[P1-end]
          Convenience implementations of DataModel are provided in the javax.faces.model package for each of the
          above (see Section 4.2.1.4 “Concrete Implementations”), and must be used by the UIData component to create the
          required DataModel wrapper.

          Show
          Ed Burns added a comment - Section 4.1.3.2 in the spec PDF must be updated as well for this issue to be considered closed. The relevant text in the latest version of the spec is the following: The current value identified by the value property is normally of type DataModel. [P1-start-uidataModel] However, a DataModel wrapper instance must automatically be provided by the JSF implementation if the current value is of one of the following types: java.util.List Array of java.util.Object java.sql.ResultSet (which therefore also supports javax.sql.RowSet) javax.servlet.jsp.jstl.sql.Result Any other Java object is wrapped by a DataModel instance with a single row. [P1-end] Convenience implementations of DataModel are provided in the javax.faces.model package for each of the above (see Section 4.2.1.4 “Concrete Implementations”), and must be used by the UIData component to create the required DataModel wrapper.
          Hide
          Ed Burns added a comment -

          I have some comments about the changebundle, but I'll add them on the impl issue JAVASERVERFACES-3785.

          Show
          Ed Burns added a comment - I have some comments about the changebundle, but I'll add them on the impl issue JAVASERVERFACES-3785 .
          Hide
          arjan tijms added a comment -

          The relevant text in the latest version of the spec is the following:

          The spec currently lists:

          • java.util.List
          • Array of java.util.Object
          • java.sql.ResultSet
          • javax.servlet.jsp.jstl.sql.Result
          • (Object wrapped as single row)

          But java.util.Collection is missing, while this was added via a spec issue (JAVASERVERFACES_SPEC_PUBLIC-479).

          The new list would therefor become:

          • java.util.List
          • Array of java.util.Object
          • java.sql.ResultSet
          • javax.servlet.jsp.jstl.sql.Result
          • java.util.Collection
          • java.lang.Iterable
          • (Object wrapped as single row)

          Also, a similar list appears in UIRepeat, but I can't find anything about that in the spec.

          The updated text in section 4.1.3.2 after this update (and after taking into account the change from 2.2) would be the following:

          The current value identified by the value property is normally of type DataModel. [P1-start-uidataModel]However, a DataModel wrapper instance must automatically be provided by the JSF implementation if the current value is of one of the following types:

          java.util.List
          Array of java.util.Object
          java.sql.ResultSet (which therefore also supports javax.sql.RowSet)
          javax.servlet.jsp.jstl.sql.Result
          java.util.Collection
          java.lang.Iterable
          Any other Java object is wrapped by a DataModel instance with a single row.[P1-end]

          Show
          arjan tijms added a comment - The relevant text in the latest version of the spec is the following: The spec currently lists: java.util.List Array of java.util.Object java.sql.ResultSet javax.servlet.jsp.jstl.sql.Result (Object wrapped as single row) But java.util.Collection is missing, while this was added via a spec issue ( JAVASERVERFACES_SPEC_PUBLIC-479 ). The new list would therefor become: java.util.List Array of java.util.Object java.sql.ResultSet javax.servlet.jsp.jstl.sql.Result java.util.Collection java.lang.Iterable (Object wrapped as single row) Also, a similar list appears in UIRepeat , but I can't find anything about that in the spec. The updated text in section 4.1.3.2 after this update (and after taking into account the change from 2.2) would be the following: The current value identified by the value property is normally of type DataModel. [P1-start-uidataModel] However, a DataModel wrapper instance must automatically be provided by the JSF implementation if the current value is of one of the following types: java.util.List Array of java.util.Object java.sql.ResultSet (which therefore also supports javax.sql.RowSet) javax.servlet.jsp.jstl.sql.Result java.util.Collection java.lang.Iterable Any other Java object is wrapped by a DataModel instance with a single row. [P1-end]
          Hide
          arjan tijms added a comment -

          Patch for ui:repeat's taglib/tld doc

          Show
          arjan tijms added a comment - Patch for ui:repeat's taglib/tld doc
          Hide
          arjan tijms added a comment -

          Oops, UIRepeat changes did not make it into previous bundle

          Show
          arjan tijms added a comment - Oops, UIRepeat changes did not make it into previous bundle
          Hide
          Manfred Riem added a comment -

          Applied to 2.3 trunk,

          svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1103, UIRepeat and UIData supports Iterable"
          Sending jsf-ri/conf/share
          Sending jsf-ri/conf/share/ui.taglib.xml
          Sending jsf-ri/conf/share/ui.tld
          Transmitting file data ..
          Committed revision 14464.

          Show
          Manfred Riem added a comment - Applied to 2.3 trunk, svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1103 , UIRepeat and UIData supports Iterable" Sending jsf-ri/conf/share Sending jsf-ri/conf/share/ui.taglib.xml Sending jsf-ri/conf/share/ui.tld Transmitting file data .. Committed revision 14464.

            People

            • Assignee:
              Manfred Riem
              Reporter:
              Ed Burns
            • Votes:
              13 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: