According to the javadoc for ConvertUtils, a String <->java.sql.Date converter is registered by default:

http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.5/docs/api/org/apache/commons/beanutils/ConvertUtils.html

I don't think you need to do anything unless you need something to convert to java.util.Date, which isn't a conversion supported by default.

Joe


Someone on struts-user posted a DateBeanUtilsConverter class that I need
help using.  It implements Converter, and from the BeanUtils API it sounds
like I need to "register" this class somewhere so that
PropertyUtils.copyProperties will use it to convert the Date object in my
Value Object into a String for the ActionForm property.

Right now, this only if both the ActionForm [contactForm] and the Value
Object [contact] have matching property types.  And then it blows up if you
type in something other than YYYY-MM-DD in the text area.  I need a String
for the ActionForm (it's coming from an HTML form) and a Date (currently
java.sql.Date, but I'm flexible) for the Value Object.
  PropertyUtils.copyProperties( contactForm, contact );

I'm sure this has been done before, but I'm having trouble adapting the
examples I've found into a Struts app.
I've found the 'ConvertUtils' class now... does anyone have advice on where
to do the registering of the Converter?  I do have a ServletContextListener,
so I think that's good for now.  Please let me know if there's a better
place.

Thanks for any advice on this,

--
--
* Joe Germuska { [EMAIL PROTECTED] }
"It's pitiful, sometimes, if they've got it bad. Their eyes get glazed, they go white, their hands tremble.... As I watch them I often feel that a dope peddler is a gentleman compared with the man who sells records."
--Sam Goody, 1956

--
To unsubscribe, e-mail: <mailto:commons-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-user-help@;jakarta.apache.org>

Reply via email to