Hi Rick,

That's why I include the horrible if statement in
StringConverterDateDecorator.

                if (type==String.class &&  value.getClass()==Date.class)
                {
                        /* do conversion */
                }
                else
                {
                        /* stringConverter is an instance of the
                           org.apache.commons.beanutils.converters.StringConverter */
                        returnValue = stringConverter.convert(type, value);
                }

When the target type is String and passed value is Date, we do the
conversion. Otherwise, I call the default StringConverter.

I test it here, using BeanUtils.copyProperties, and runs ok, however the
design is horrible :)

Cheers
Elder

-----Mensagem original-----
De: Rick Reumann [mailto:[EMAIL PROTECTED]]
Enviada em: quarta-feira, 16 de outubro de 2002 19:36
Para: Elderclei R Reami
Cc: Struts List
Assunto: Re: RES: Re[4]: BeanUtils and java.util.Date




On Wednesday, October 16, 2002, 5:54:50 PM, Elderclei wrote:

ERR> Here is the horrible piece of code for the converters:

     Hi. I can get a nice Date converter to work but how can you use
     BeanUtils to go the other way -converting your business bean
     java.util.Date to a String in your form bean? When I register the
     String converter (like you Elderclei created) it will end up
     obviously trying to convert all my Strings.

--

Rick
mailto:[EMAIL PROTECTED]



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

Reply via email to