3 Replies Latest reply on Jun 10, 2007 6:31 PM by pmuir

    [JBSEAM-1302]: Conversion support for selectMany for Set imp

      Hello!

      I am also experiencing problems with <s:entityconverter /> and a set as a backing bean. Lists work, Sets do not. I remember a similar bug report which was closed by Pete Muir. He said the limitations of using a selectMany with a set was actually a limitation of the jsf specification. (http://jira.jboss.com/jira/browse/JBSEAM-1152)

      At the end of that issue he posted a link to the jsf RI docs http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/component/UISelectMany.html

      My reading of the documentation would be that you can not use a set UNLESS you specified a converter which would be fine for me. Is that correct?

      The obvious work around of using lists instead of sets is not possible for me because of the "cannot fetch multiple bags" problems. It would be great if someone could tell me if it is possible and where to start to get this working.

      If this is a real limitation of the jsf specification please close 1302 as a duplicate of 1152.



      Regards

      Felix

      P.S.: Using entityConverter I always get the error message

      com.sun.facelets.tag.MetaRulesetImpl finish
      SCHWERWIEGEND: /benutzer/edit.xhtml @53,77 entityClass="my.example.clazz" Unhandled by MetaTagHandler for type org.jboss.seam.ui.EntityConverter
      


      Might this be related?

        • 1. Re: [JBSEAM-1302]: Conversion support for selectMany for Set

          I took a closer look at the jsf implementation. The relvant bit of code is this (from com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectManyValue()):

          
           modelType = valueExpression.getType(context.getELContext());
           // Does the valueExpression resolve properly to something with
           // a type?
           if (null != modelType) {
           if (modelType.isArray()) {
           result = convertSelectManyValues(context,
           uiSelectMany,
           modelType,
           newValues);
           } else if (List.class.isAssignableFrom(modelType)) {
           result = Arrays.asList((Object[]) convertSelectManyValues(
           context,
           uiSelectMany,
           Object[].class,
           newValues));
           } else {
           throwException = true;
           }
          
          
          


          So, this seems to be a limitation of JSF indeed.

          What surprises me is that it would be trivival to fix. Sets must have been left out on purpose. Does anybody know why? The way the html component work, support for sets seems more natural then lists.

          Regards

          Felix

          • 2. Re: [JBSEAM-1302]: Conversion support for selectMany for Set

            Replying to myself again:

            MyFaces does a similar thing:

             if (List.class.isAssignableFrom(valueType)) {
            
             // do something
            
            }
            
             if (!valueType.isArray())
             {
             throw new IllegalArgumentException("ValueBinding for UISelectMany : "+getPathToComponent(component)+" must be of type List or Array");
             }
            


            So, please close Bug 1302 as unfixable.

            Regards

            Felix

            P.S.: Will update JIRA with a link to the is thread.

            • 3. Re: [JBSEAM-1302]: Conversion support for selectMany for Set
              pmuir

               

              "fhh" wrote:
              What surprises me is that it would be trivival to fix. Sets must have been left out on purpose. Does anybody know why?


              Adam Winer blogged about this regarding UIData - IIRC its mainly an oversight, but there are also performance problems. I'm pretty sure we can get this sorted in JSF 2.0 - I have a utility class here http://jroller.com/page/pmuir?entry=using_sets_in_jsf for backing DataModels, it should work fine for selections as well, but I haven't checked ;) If it does I'll add it to seam-ui