Yujun Liang wrote:
Laurie,

Thanks for all the replies.

Can you point me to a document describe how to change the default converter
used by Struts? I was not aware of that.

Struts uses the default converter supplied by BeanUtils directly, it doesn't have its own instance.

By the way, what's the disadvantage
to have common beanutil to support java.util.Date as well?

Well, for one, the thread-saftely issue Ryan brought up. There's also the issue that you probably want to use different date formats for different locales.

L.


Thanks

On 10/30/05, Laurie Harper <[EMAIL PROTECTED]> wrote:

Right, I create a fresh instance of BeanUtilsBean and register the
converter at the point of use, to avoid that being a problem.

L.

Ryan Stewart wrote:

Not to mention that DateFormats are not thread-safe, and I'm fairly sure
Converter access is not synchronized.



----Original Message----
From: [EMAIL PROTECTED]
Date: Oct 28, 2005 3:17:17 PM
To: dev@struts.apache.org
Subj: Re: java.util.Date in Action Form Bean

So far I'm doing this by registering a custom implementation of
Converter which I instantiate with a suitable instance of
SimpleDateFormat before calling BeanUtilsBean.copyProperties().

[...]


That's untested code, and the implementation of convert() should incude
checks for value being null, not a String, etc and handling for if the
date can't be parsed... but it gives you the rough idea.



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





--
Yujun Liang
[EMAIL PROTECTED]



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

Reply via email to