You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org> on 2010/05/28 20:52:37 UTC

[jira] Created: (MYFACES-2739) Pass through String values in EnumConverter.getAsString()

Pass through String values in EnumConverter.getAsString()
---------------------------------------------------------

                 Key: MYFACES-2739
                 URL: https://issues.apache.org/jira/browse/MYFACES-2739
             Project: MyFaces Core
          Issue Type: Improvement
          Components: JSR-314
    Affects Versions: 2.0.0
            Reporter: Jakob Korherr
            Assignee: Jakob Korherr


>From the related spec issue (#817 - https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=817):

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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2739) Pass through String values in EnumConverter.getAsString()

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12873134#action_12873134 ] 

Jakob Korherr commented on MYFACES-2739:
----------------------------------------

OK, it was just a proposal. I took a look at the spec issue #470 and it is not completely the same problem, but they are definitely related!

We'll see what JSF 2.1 brings!

> Pass through String values in EnumConverter.getAsString()
> ---------------------------------------------------------
>
>                 Key: MYFACES-2739
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2739
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>         Attachments: MYFACES-2739.patch
>
>
> From the related spec issue (#817 - https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=817):
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2739) Pass through String values in EnumConverter.getAsString()

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12873129#action_12873129 ] 

Leonardo Uribe commented on MYFACES-2739:
-----------------------------------------

The original spec issue:

https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=470

was reopened and it will be fixed on 2.1 release. Please do not change the current behavior. The preffered solution for the user should be use a custom converter.

> Pass through String values in EnumConverter.getAsString()
> ---------------------------------------------------------
>
>                 Key: MYFACES-2739
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2739
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>         Attachments: MYFACES-2739.patch
>
>
> From the related spec issue (#817 - https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=817):
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2739) Pass through String values in EnumConverter.getAsString()

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12873121#action_12873121 ] 

Jakob Korherr commented on MYFACES-2739:
----------------------------------------

Attached proposed patch.

If no objections, I will commit this patch soon!

> Pass through String values in EnumConverter.getAsString()
> ---------------------------------------------------------
>
>                 Key: MYFACES-2739
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2739
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>         Attachments: MYFACES-2739.patch
>
>
> From the related spec issue (#817 - https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=817):
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2739) Pass through String values in EnumConverter.getAsString()

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12877927#action_12877927 ] 

Leonardo Uribe commented on MYFACES-2739:
-----------------------------------------

Hi Jakob

I think for now we can let the param for this specific fix. In the future, if we see more compatibility problems between 1.2 and 2.0, we can introduce the param.

regards,

Leonardo

> Pass through String values in EnumConverter.getAsString()
> ---------------------------------------------------------
>
>                 Key: MYFACES-2739
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2739
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>             Fix For: 2.0.1
>
>         Attachments: MYFACES-2739.patch
>
>
> From the related spec issue (#817 - https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=817):
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2739) Pass through String values in EnumConverter.getAsString()

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12873110#action_12873110 ] 

Jakob Korherr commented on MYFACES-2739:
----------------------------------------

I think we could introduce a config param to enable the EnumConverter to pass through String values until the issue was reviewed by the EG and the spec was changed (which will maybe not happen until JSF 2.1).

I will provide a patch for this scenario.

> Pass through String values in EnumConverter.getAsString()
> ---------------------------------------------------------
>
>                 Key: MYFACES-2739
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2739
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>
> From the related spec issue (#817 - https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=817):
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MYFACES-2739) Pass through String values in EnumConverter.getAsString()

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2739?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr updated MYFACES-2739:
-----------------------------------

    Status: Patch Available  (was: Open)

> Pass through String values in EnumConverter.getAsString()
> ---------------------------------------------------------
>
>                 Key: MYFACES-2739
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2739
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>         Attachments: MYFACES-2739.patch
>
>
> From the related spec issue (#817 - https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=817):
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2739) Pass through String values in EnumConverter.getAsString()

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12873926#action_12873926 ] 

Martin Marinschek commented on MYFACES-2739:
--------------------------------------------

Hi Gentlemen,

I don't think it is a good idea to wait for 2.1. As slow as things currently run inside the big companies involved, we should rather have a context-parameter "strict-compatibility mode" and we should try to fix such issues (which are really issues hindering people using JSF properly) if this is not set to true.

best regards,

Martin

> Pass through String values in EnumConverter.getAsString()
> ---------------------------------------------------------
>
>                 Key: MYFACES-2739
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2739
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>         Attachments: MYFACES-2739.patch
>
>
> From the related spec issue (#817 - https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=817):
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2739) Pass through String values in EnumConverter.getAsString()

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12877913#action_12877913 ] 

Jakob Korherr commented on MYFACES-2739:
----------------------------------------

Hi Martin and Leo,

Yes this is definitely a good idea. I think there are currently a lot of open (spec) issues which could block some JSF 2.0 use cases, but which will not be solved by JSF 2.0, because they require a change in behavior. Introducing such a context-parameter will 1) give users the chance to bypass these problems and 2) give us the chance to fix the issues as they appear without having to wait for the EG's decision for JSF 2.1.

Any ideas for the name? Mabye org.apache.myfaces.STRICT_COMPATIBILITY_MODE with a default value of true as Martin suggested.

Regards,
Jakob

> Pass through String values in EnumConverter.getAsString()
> ---------------------------------------------------------
>
>                 Key: MYFACES-2739
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2739
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>             Fix For: 2.0.1
>
>         Attachments: MYFACES-2739.patch
>
>
> From the related spec issue (#817 - https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=817):
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.