You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Thomas Winkler (JIRA)" <de...@myfaces.apache.org> on 2005/11/07 17:22:20 UTC

[jira] Created: (MYFACES-790) Select Menus bound to Integer value with calculated el expression in itemValue don't work

Select Menus bound to Integer value with calculated el expression in itemValue don't work
-----------------------------------------------------------------------------------------

         Key: MYFACES-790
         URL: http://issues.apache.org/jira/browse/MYFACES-790
     Project: MyFaces
        Type: Bug
  Components: Implementation  
    Versions: 1.1.1    
 Environment: MyFaces 1.1.1, WebSphere 5.1.2, Windows
    Reporter: Thomas Winkler


Assume the following code:
<h:selectOneMenu value="#{bean.integerValue}" required="true">
<f:selectItem itemValue="#{bean2.integerValue1 + bean2.integerValue2}" itemLabel="someLabel"/>
</h:selectOneMenu>

The problem here is, that the itemValue-property will be evaluated to a value of type java.lang.Long. The submitted value will be of type java.lang.Integer. When both values are the same, e.g. 9, the test in the class _SelectItemsUtil, line 68

   integerValue.equals(longValue)

will fail and we get an error.

Suggestion for problem solution:
The problem may be resolved according 4.1.13.2 of JSF Spec 1.1 by trying to convert the EL calculated value to the data type of the parent component's type.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-790) Select Menus bound to Integer value with calculated el expression in itemValue don't work

Posted by "Mike Kienenberger (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12480921 ] 

Mike Kienenberger commented on MYFACES-790:
-------------------------------------------

Carsten,

It is your responsiblity as the programmer to insure that the type of itemValue is the correct type.  Conversion only happens between itemLabels and itemValues, not between itemValues and your backing bean methods.

This is a different issue than the original reported problem (where it looks like the bug is that the EL expression parser is returning a Long when maybe it should be returning an Integer).

> Select Menus bound to Integer value with calculated el expression in itemValue don't work
> -----------------------------------------------------------------------------------------
>
>                 Key: MYFACES-790
>                 URL: https://issues.apache.org/jira/browse/MYFACES-790
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 1.1.1
>         Environment: MyFaces 1.1.1, WebSphere 5.1.2, Windows
>            Reporter: Thomas Winkler
>         Assigned To: Manfred Geiler
>
> Assume the following code:
> <h:selectOneMenu value="#{bean.integerValue}" required="true">
> <f:selectItem itemValue="#{bean2.integerValue1 + bean2.integerValue2}" itemLabel="someLabel"/>
> </h:selectOneMenu>
> The problem here is, that the itemValue-property will be evaluated to a value of type java.lang.Long. The submitted value will be of type java.lang.Integer. When both values are the same, e.g. 9, the test in the class _SelectItemsUtil, line 68
>    integerValue.equals(longValue)
> will fail and we get an error.
> Suggestion for problem solution:
> The problem may be resolved according 4.1.13.2 of JSF Spec 1.1 by trying to convert the EL calculated value to the data type of the parent component's type.

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


[jira] Commented: (MYFACES-790) Select Menus bound to Integer value with calculated el expression in itemValue don't work

Posted by "Carsten Eschenröder (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12480842 ] 

Carsten Eschenröder commented on MYFACES-790:
---------------------------------------------

We have a similar problem with the new Version 1.1.5

A parent t:selectOneMenu have a value binding to a Long Attribute. One f:selectItem's itemValue Attribute was set to -1. The generated SelectItem Object returns a String "-1" when calling getValue().  The same check as mentioned above fails and finally returned an error.

I thing the behaviour is not correct. Either the SelectItem must be created with an value of the correct type or the type must by converted before checking if the option is available.


> Select Menus bound to Integer value with calculated el expression in itemValue don't work
> -----------------------------------------------------------------------------------------
>
>                 Key: MYFACES-790
>                 URL: https://issues.apache.org/jira/browse/MYFACES-790
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 1.1.1
>         Environment: MyFaces 1.1.1, WebSphere 5.1.2, Windows
>            Reporter: Thomas Winkler
>         Assigned To: Manfred Geiler
>
> Assume the following code:
> <h:selectOneMenu value="#{bean.integerValue}" required="true">
> <f:selectItem itemValue="#{bean2.integerValue1 + bean2.integerValue2}" itemLabel="someLabel"/>
> </h:selectOneMenu>
> The problem here is, that the itemValue-property will be evaluated to a value of type java.lang.Long. The submitted value will be of type java.lang.Integer. When both values are the same, e.g. 9, the test in the class _SelectItemsUtil, line 68
>    integerValue.equals(longValue)
> will fail and we get an error.
> Suggestion for problem solution:
> The problem may be resolved according 4.1.13.2 of JSF Spec 1.1 by trying to convert the EL calculated value to the data type of the parent component's type.

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


[jira] Updated: (MYFACES-790) Select Menus bound to Integer value with calculated el expression in itemValue don't work

Posted by "Howard Abrams (JIRA)" <de...@myfaces.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-790?page=all ]

Howard Abrams updated MYFACES-790:
----------------------------------

    Fix Version: 1.1.3

> Select Menus bound to Integer value with calculated el expression in itemValue don't work
> -----------------------------------------------------------------------------------------
>
>          Key: MYFACES-790
>          URL: http://issues.apache.org/jira/browse/MYFACES-790
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation
>     Versions: 1.1.1
>  Environment: MyFaces 1.1.1, WebSphere 5.1.2, Windows
>     Reporter: Thomas Winkler
>      Fix For: 1.1.3

>
> Assume the following code:
> <h:selectOneMenu value="#{bean.integerValue}" required="true">
> <f:selectItem itemValue="#{bean2.integerValue1 + bean2.integerValue2}" itemLabel="someLabel"/>
> </h:selectOneMenu>
> The problem here is, that the itemValue-property will be evaluated to a value of type java.lang.Long. The submitted value will be of type java.lang.Integer. When both values are the same, e.g. 9, the test in the class _SelectItemsUtil, line 68
>    integerValue.equals(longValue)
> will fail and we get an error.
> Suggestion for problem solution:
> The problem may be resolved according 4.1.13.2 of JSF Spec 1.1 by trying to convert the EL calculated value to the data type of the parent component's type.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-790) Select Menus bound to Integer value with calculated el expression in itemValue don't work

Posted by "Mike Kienenberger (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12480932 ] 

Mike Kienenberger commented on MYFACES-790:
-------------------------------------------

Thomas,

I took a look at 4.1.13.2.   There's nothing in there about coercing itemValue.

The server-side value of this item, of the same
basic data type as the parent component's
value. If the parent component type's value is a
value binding expression that points at a
primitive, this value must be of the
corresponding wrapper type

The only possible bug is whether the El parser should return an Integer when adding two Integers.   I'm not going to investigate that.

> Select Menus bound to Integer value with calculated el expression in itemValue don't work
> -----------------------------------------------------------------------------------------
>
>                 Key: MYFACES-790
>                 URL: https://issues.apache.org/jira/browse/MYFACES-790
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 1.1.1
>         Environment: MyFaces 1.1.1, WebSphere 5.1.2, Windows
>            Reporter: Thomas Winkler
>         Assigned To: Manfred Geiler
>
> Assume the following code:
> <h:selectOneMenu value="#{bean.integerValue}" required="true">
> <f:selectItem itemValue="#{bean2.integerValue1 + bean2.integerValue2}" itemLabel="someLabel"/>
> </h:selectOneMenu>
> The problem here is, that the itemValue-property will be evaluated to a value of type java.lang.Long. The submitted value will be of type java.lang.Integer. When both values are the same, e.g. 9, the test in the class _SelectItemsUtil, line 68
>    integerValue.equals(longValue)
> will fail and we get an error.
> Suggestion for problem solution:
> The problem may be resolved according 4.1.13.2 of JSF Spec 1.1 by trying to convert the EL calculated value to the data type of the parent component's type.

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