> -----Original Message----- > From: Martin Kindler [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 02, 2004 8:59 AM > To: [EMAIL PROTECTED] > Subject: A question of style (newbie) > > > I need a Timestamp field in an ActionForm of me (called > starttime). The > value of this field should be set from > an HTML form. Using <html:text> the property of the bean has > to of type > String. > Therefore I created a "virtual" property, i.e. getter- and > setter-methods for my Timestamp field which do the conversion with > another "field"-name (starttimestr). This works. > The question is: is this considered good style? Are there any problems > to be aware of? I am new to Java and Struts, so I think I better ask.
It's usually better to convert from String to whatever your end type is in the action class. You can use either BeanUtils.copyProperties() or BeanUtils.convert(), or just do it all yourself if you would like. A strict following of MVC puts the form bean squarely in the view, and as such all conversion should happen in the controller (action in struts lingo). --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

