You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Dainius Vaznys (JIRA)" <de...@myfaces.apache.org> on 2007/02/27 16:23:05 UTC
[jira] Created: (MYFACES-1545) UISelectOne validation fails with
custom converter
UISelectOne validation fails with custom converter
--------------------------------------------------
Key: MYFACES-1545
URL: https://issues.apache.org/jira/browse/MYFACES-1545
Project: MyFaces Core
Issue Type: Bug
Affects Versions: 1.1.5
Reporter: Dainius Vaznys
This seems to be closely related with MYFACES-1328.
I have a Converted configured with a UISelectOne which converts between strings and enum values, i.e. getAsObject() returns an Enum instance. After the convertion takes place UISelectOne.validateValue() is invoked to check if the Enum instance is among select items. This code definitely does not work:
Object itemValue = item.getValue();
if (value==itemValue || value.equals(itemValue))
{
return true;
}
as it tries to match an Enum instance against a string.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
Re: [jira] Created: (MYFACES-1545) UISelectOne validation fails with custom converter
Posted by Mike Kienenberger <mk...@gmail.com>.
Guy,
In your particular case, you can try to use
<f:selectItem itemValue="{1}" itemLabel="1" />
On 2/28/07, Guy Coleman <gu...@prolog.uk.com> wrote:
> On 27/02/2007 15:23, Dainius Vaznys (JIRA) wrote:
> > UISelectOne validation fails with custom converter
> > --------------------------------------------------
> >
> > Key: MYFACES-1545
> > URL: https://issues.apache.org/jira/browse/MYFACES-1545
> > Project: MyFaces Core
> > Issue Type: Bug
> > Affects Versions: 1.1.5
> > Reporter: Dainius Vaznys
> >
> >
> > This seems to be closely related with MYFACES-1328.
> >
> > I have a Converted configured with a UISelectOne which converts between strings and enum values, i.e. getAsObject() returns an Enum instance. After the convertion takes place UISelectOne.validateValue() is invoked to check if the Enum instance is among select items. This code definitely does not work:
> > Object itemValue = item.getValue();
> > if (value==itemValue || value.equals(itemValue))
> > {
> > return true;
> > }
> >
> > as it tries to match an Enum instance against a string.
>
>
> This sounds a lot like a problem I discovered when I upgraded from 1.1.3
> to 1.1.5:
>
> https://javaserverfaces.dev.java.net/servlets/ReadMsg?list=users&msgNo=175
>
> Short answer: that's how it's supposed to work in JSF 1.1 and I needed
> to change my code.
>
> -Guy.
>
Re: [jira] Created: (MYFACES-1545) UISelectOne validation fails with
custom converter
Posted by Guy Coleman <gu...@prolog.uk.com>.
On 27/02/2007 15:23, Dainius Vaznys (JIRA) wrote:
> UISelectOne validation fails with custom converter
> --------------------------------------------------
>
> Key: MYFACES-1545
> URL: https://issues.apache.org/jira/browse/MYFACES-1545
> Project: MyFaces Core
> Issue Type: Bug
> Affects Versions: 1.1.5
> Reporter: Dainius Vaznys
>
>
> This seems to be closely related with MYFACES-1328.
>
> I have a Converted configured with a UISelectOne which converts between strings and enum values, i.e. getAsObject() returns an Enum instance. After the convertion takes place UISelectOne.validateValue() is invoked to check if the Enum instance is among select items. This code definitely does not work:
> Object itemValue = item.getValue();
> if (value==itemValue || value.equals(itemValue))
> {
> return true;
> }
>
> as it tries to match an Enum instance against a string.
This sounds a lot like a problem I discovered when I upgraded from 1.1.3
to 1.1.5:
https://javaserverfaces.dev.java.net/servlets/ReadMsg?list=users&msgNo=175
Short answer: that's how it's supposed to work in JSF 1.1 and I needed
to change my code.
-Guy.
[jira] Commented: (MYFACES-1545) UISelectOne validation fails with
custom converter
Posted by "Martin Schaaf (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/MYFACES-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12755441#action_12755441 ]
Martin Schaaf commented on MYFACES-1545:
----------------------------------------
I have the same issue with the following converter javax.faces.convert.LongConverter specified. The following code works with myfaces 1.1.4 but no longer in 1.1.7.
<h:selectOneRadio id="id"
value="#{bean.value}" layout="pageDirection"
valueChangeListener="#{bean.listener}"
onchange="submit()" converter="LongConverter">
<f:selectItem itemValue="1" itemLabel="label1" />
<f:selectItem itemValue="0" itemLabel="label2" />
</h:selectOneRadio>
bean.value is a Long object.
The select item values are created as Strings and get compared to Longs.
This code works in myfaces 1.1.4 with and without specifiyng a converter and does no longer work in version 1.1.7 with or without a converter.
> UISelectOne validation fails with custom converter
> --------------------------------------------------
>
> Key: MYFACES-1545
> URL: https://issues.apache.org/jira/browse/MYFACES-1545
> Project: MyFaces Core
> Issue Type: Bug
> Affects Versions: 1.1.5
> Reporter: Dainius Vaznys
>
> This seems to be closely related with MYFACES-1328.
> I have a Converted configured with a UISelectOne which converts between strings and enum values, i.e. getAsObject() returns an Enum instance. After the convertion takes place UISelectOne.validateValue() is invoked to check if the Enum instance is among select items. This code definitely does not work:
> Object itemValue = item.getValue();
> if (value==itemValue || value.equals(itemValue))
> {
> return true;
> }
> as it tries to match an Enum instance against a string.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.