Details

    • Type: Task Task
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Validation/Conversion
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      817
    • Status Whiteboard:
      Hide

      size_small importance_small

      Show
      size_small importance_small

      Description

      In every standard by-type converter in the JSF spec, except for the
      EnumConverter, the following code is present in getAsString():

      if (value instanceof String)
      {
      return (String) value;
      }

      Thus allowing String values to be used directly as the String representation of
      the type. This allows e.g. the following scenario for an Integer property in the
      managed bean to work, although "1234" beeing a String and not an Integer:

      <h:selectOneRadio value="#

      {myBean.inputInt}

      ">
      <f:selectItem itemValue="1234" />
      </h:selectOneRadio>

      However the spec javadoc of the EnumConverter does not include this scenario and
      thus EnumConverter.getAsString() throws a ConverterException when providing a
      String value. This means that the following scenario won't work, although it
      should on my opinion (note that this currently does work with Mojarra because of
      an implementation issue - see [1] for details):

      <h:selectOneRadio value="#

      {myBean.inputEnum}">
      <f:selectItem itemValue="EnumConstant1" />
      </h:selectOneRadio>

      EnumConstant1 beeing a valid constant in the enum type referenced by
      #{myBean.inputEnum}

      . The only way to make this work right now is to use a
      ValueExpression that resolves to the needed enum constant, so something like this:

      <h:selectOneRadio value="#

      {myBean.inputEnum}

      ">
      <f:selectItem itemValue="#

      {myBean.propertyThatResolvesToEnumConstant1}

      " />
      </h:selectOneRadio>

      This is not very straight forward IMHO, thus I think EnumConverter.getAsString()
      should pass through String-values just as every other standard by-type converter
      does.

      See also the discussion on the MyFaces user mailing list about this [2].

      [1] https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1694
      [2] http://www.mail-archive.com/users@myfaces.apache.org/msg55742.html

        Activity

        Hide
        Ed Burns added a comment -

        sheetalv

        Show
        Ed Burns added a comment - sheetalv
        Hide
        rogerk added a comment -

        triage

        Show
        rogerk added a comment - triage
        Hide
        Ed Burns added a comment -

        Bulk assign all of Sheetal's spec issues to me.

        Show
        Ed Burns added a comment - Bulk assign all of Sheetal's spec issues to me.
        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 Minor

        Show
        Manfred Riem added a comment - Setting priority to Minor

          People

          • Assignee:
            Unassigned
            Reporter:
            Jakob Korherr
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: