You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by James Richards <ja...@northps.com> on 2006/05/25 20:47:56 UTC
convertNumber
I'm having a problem upgrading MyFaces due to our liberal use of the convertNumber tag. After looking at the mailing list it's clear that the breakage is per-specification. What is the recommended solution for number conversion?
Thanks,
James
RE: convertNumber
Posted by James Richards <ja...@northps.com>.
I ended up making a custom converter that I'm testing now. One caveat to notice is to be sure that you understand the factory nature of the NumberFormat as I found its behavior a bit suprising:
$ jython.bat
Jython 2.2a1 on java1.5.0_06 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> from java.text import *
>>> decFmt = DecimalFormat.getInstance()
>>> decFmt
java.text.DecimalFormat@674dc
>>> intFmt = NumberFormat.getIntegerInstance()
>>> intFmt
java.text.DecimalFormat@674dc
>>> val = intFmt.parse('1')
>>> val
1L
>>> intFmt.setParseIntegerOnly(1)
>>> val = intFmt.parse('1')
>>> val
1L
>>>
Notice that the same DecimalFormat instance is returned for integer parsing. This is also the same instance returned in my JBoss application server running on the same box! I think this is related to the JDK 1.5 startup optimizations as the same instance is returned even if the server is stopped and the jython JVM restarted. In my case, the Long value returned was failing when being set on a JavaBean property of type Integer so I had to perform explicit Integer instantiation.
Hope that helps,
James
-----Original Message-----
From: Jeff Bischoff [mailto:jbischoff@klkurz.com]
Sent: Wed 5/31/2006 11:30 AM
To: MyFaces Discussion
Subject: Re: convertNumber
Thanks James,
How about a tomahawk converter, with the coercion back in place? (See
the JIRA)
Sounds like we already have the code for it, so why not just move that
extra functionality over to tomahawk?
Jeff Bischoff
Kenneth L Kurz & Associates, Inc.
James Richards wrote:
> I found discussion of this on the mailing list but I can't recall how I located the thread [was via google search]. Here is the JIRA issue:
>
> http://issues.apache.org/jira/browse/MYFACES-891
>
> Basically, Sun Strikes Again...
>
> Given the silence of the mailing list in response to my earlier query, I'm assuming that implementing a custom converter is the way to go. If you find another alternative, I'm interested as I will probably have to change quite a few files to fix this.
>
> Thanks,
>
> James
>
>
> -----Original Message-----
> From: Jeff Bischoff [mailto:jbischoff@klkurz.com]
> Sent: Fri 5/26/2006 1:14 PM
> To: MyFaces Discussion
> Subject: Re: convertNumber
>
> I'm also curious about this. Is there information about this breakage
> made available somewhere easily accessible?
>
> James Richards wrote:
>
>>I'm having a problem upgrading MyFaces due to our liberal use of the
>>convertNumber tag. After looking at the mailing list it's clear that
>>the breakage is per-specification. What is the recommended solution for
>>number conversion?
>>
>>Thanks,
>>
>>James
>>
>
>
>
>
Re: convertNumber
Posted by Matthias Wessendorf <ma...@apache.org>.
> Let's hope it finds its way into Tomahawk soon.
Well, this depends on reported bug, documentation, user's are happy etc.
We are happy you like that thing.
-Matthias
Re: convertNumber
Posted by Jeff Bischoff <jb...@klkurz.com>.
Mario,
I am trying out your s:convertNumber tag. Works great so far, thanks!
Examining the source code, it appears that it is identical to the old
(pre-1.1.2) ConvertNumberTag code, except that:
1) You have renamed it to "TypedNumberConverterTag"
2) You have added the "destType" attribute for (optionally) specifying
the type of number to convert to
So basically, despite being in sandbox, this seems like a very mature
component -- as it is based almost entirely on release-level code.
Let's hope it finds its way into Tomahawk soon.
Regards,
Jeff Bischoff
Kenneth L Kurz & Assoc, Inc.
Mario Ivankovits wrote:
> Hi!
>
>>How about a tomahawk converter, with the coercion back in place? (See
>>the JIRA)
>
> Yesterday I committed a convertNumber to tomahawk-sandbox which will
> automatically convert the number to the beans expected type.
>
> Ciao,
> Mario
>
>
>
Re: convertNumber
Posted by Jeff Bischoff <jb...@klkurz.com>.
:)
Mario Ivankovits wrote:
> Hi!
>
>>How about a tomahawk converter, with the coercion back in place? (See
>>the JIRA)
>
> Yesterday I committed a convertNumber to tomahawk-sandbox which will
> automatically convert the number to the beans expected type.
>
> Ciao,
> Mario
>
>
>
Re: convertNumber
Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> How about a tomahawk converter, with the coercion back in place? (See
> the JIRA)
Yesterday I committed a convertNumber to tomahawk-sandbox which will
automatically convert the number to the beans expected type.
Ciao,
Mario
Re: convertNumber
Posted by Jeff Bischoff <jb...@klkurz.com>.
Thanks James,
How about a tomahawk converter, with the coercion back in place? (See
the JIRA)
Sounds like we already have the code for it, so why not just move that
extra functionality over to tomahawk?
Jeff Bischoff
Kenneth L Kurz & Associates, Inc.
James Richards wrote:
> I found discussion of this on the mailing list but I can't recall how I located the thread [was via google search]. Here is the JIRA issue:
>
> http://issues.apache.org/jira/browse/MYFACES-891
>
> Basically, Sun Strikes Again...
>
> Given the silence of the mailing list in response to my earlier query, I'm assuming that implementing a custom converter is the way to go. If you find another alternative, I'm interested as I will probably have to change quite a few files to fix this.
>
> Thanks,
>
> James
>
>
> -----Original Message-----
> From: Jeff Bischoff [mailto:jbischoff@klkurz.com]
> Sent: Fri 5/26/2006 1:14 PM
> To: MyFaces Discussion
> Subject: Re: convertNumber
>
> I'm also curious about this. Is there information about this breakage
> made available somewhere easily accessible?
>
> James Richards wrote:
>
>>I'm having a problem upgrading MyFaces due to our liberal use of the
>>convertNumber tag. After looking at the mailing list it's clear that
>>the breakage is per-specification. What is the recommended solution for
>>number conversion?
>>
>>Thanks,
>>
>>James
>>
>
>
>
>
RE: convertNumber
Posted by James Richards <ja...@northps.com>.
I found discussion of this on the mailing list but I can't recall how I located the thread [was via google search]. Here is the JIRA issue:
http://issues.apache.org/jira/browse/MYFACES-891
Basically, Sun Strikes Again...
Given the silence of the mailing list in response to my earlier query, I'm assuming that implementing a custom converter is the way to go. If you find another alternative, I'm interested as I will probably have to change quite a few files to fix this.
Thanks,
James
-----Original Message-----
From: Jeff Bischoff [mailto:jbischoff@klkurz.com]
Sent: Fri 5/26/2006 1:14 PM
To: MyFaces Discussion
Subject: Re: convertNumber
I'm also curious about this. Is there information about this breakage
made available somewhere easily accessible?
James Richards wrote:
>
> I'm having a problem upgrading MyFaces due to our liberal use of the
> convertNumber tag. After looking at the mailing list it's clear that
> the breakage is per-specification. What is the recommended solution for
> number conversion?
>
> Thanks,
>
> James
>
Re: convertNumber
Posted by Jeff Bischoff <jb...@klkurz.com>.
I'm also curious about this. Is there information about this breakage
made available somewhere easily accessible?
James Richards wrote:
>
> I'm having a problem upgrading MyFaces due to our liberal use of the
> convertNumber tag. After looking at the mailing list it's clear that
> the breakage is per-specification. What is the recommended solution for
> number conversion?
>
> Thanks,
>
> James
>
RE: convertNumber
Posted by James Richards <ja...@northps.com>.
Or perhaps I should ask "Is there a recommended solution?" Should I simply create a new convert tag?
Thanks for any input,
James
-----Original Message-----
From: James Richards [mailto:james_richards@northps.com]
Sent: Thu 5/25/2006 2:47 PM
To: users@myfaces.apache.org
Subject: convertNumber
I'm having a problem upgrading MyFaces due to our liberal use of the convertNumber tag. After looking at the mailing list it's clear that the breakage is per-specification. What is the recommended solution for number conversion?
Thanks,
James