I made the following modifikation:

    static 
    {
        ConvertUtils.register(new CurrencyConverter(), Double.class);
        ConvertUtils.register(new PuKFloatConverter(), Float.class);
        ConvertUtils.register(new DateConverter(), Date.class);
        ConvertUtils.register(new DateConverter(), String.class);
        ConvertUtils.register(new LongConverter(defaultLong), Long.class);
        ConvertUtils.register(new IntegerConverter(defaultLong), Integer.class);
    }

"PuKFloatConverter" is just a small modification of "CurrencyConverter".
But the conversion works only "one-way". The string "12,7" is converted
to float and back again the float is converted to "12.7" ...

At this point "convert" is called with value=null and no conversion is done:

public class PuKFloatConverter implements Converter
{
   public Object convert(final Class type, final Object value)
   {
      if (value == null)
      {
         return null;
      }
      else
      {
        ....



hmmm,...


-- 

  Oliver Raupach





-----Ursprüngliche Nachricht-----
Von: Matt Raible [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 4. Januar 2007 19:20
An: [email protected]
Betreff: Re: [appfuse-user] change number format ?

For Struts tags, you'll need a converter.  Look at the ones registered
at the top of BaseAction.java and possibly write/add a new one based
on your type.

Matt

On 1/4/07, Oliver Raupach <[EMAIL PROTECTED]> wrote:
>
> Yes, JSTL's <fmt:formatNumber> tag works fine form me.
>
> But what's about this:
>
>     <li>
>         <puk:label styleClass="desc" key="gespraechspreisForm.preis"/>
>         <html:errors property="preis"/>
>         <html:text property="preis" styleId="preis" styleClass="text medium"/>
>
>     </li>
>
> If I filled this form with "123,45" it is converted to "0".
>
> --
>
>   Oliver Raupach
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Matt Raible [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 4. Januar 2007 19:00
> An: [email protected]
> Betreff: Re: [appfuse-user] change number format ?
>
> Which web framework are you using?  You should be able to use JSTL's
> <fmt:formatNumber> tag.
>
> http://ndpsoftware.com/JSPXMLCheatSheet.html
>
> Matt
>
> On 1/4/07, Oliver Raupach <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > how to change the number format of type float?
> >
> > At the moment it is formatted like this: 1234.56 Euro
> > I would like to have this: 1234,56 Euro
> >
> > --
> >
> >   Oliver Raupach
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> http://raibledesigns.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to