struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <andrew.david.h...@gridnode.com>
Subject RE: endless actionforms and valueobjects questions
Date Tue, 17 Jun 2003 07:04:51 GMT
<snip>
Except for boolean properties that back a checkbox field, you should NOT
be using other than strings in your form beans.
</snip>

Id go all the way and say you should use Strings for these too. I dont see
any reason to treat checkboxes differently (well apart from the reset
issue) - and while its a checkbox today, tomorrow you might want to switch
its visual representation over to a drop down select with yes/no (or
whatever) options, and perhaps add an empty option so you can tell if the
user forgot to think about whether they wanted to choose "yes" for that
field...

-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Tuesday, 17 June 2003 14:57
To: Struts Users Mailing List
Subject: Re: endless actionforms and valueobjects questions




On Sun, 8 Jun 2003, florian wrote:

> Date: Sun, 8 Jun 2003 20:00:31 +0200
> From: florian <csshsh@structbench.com>
> Reply-To: Struts Users Mailing List <struts-user@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: endless actionforms and valueobjects questions
>
>
> hi!
>
> i dont want to start the discussion again. just wanted some feedback
> on some thoughs =)
>
> i had some dicussions with some friends who argued that valueObjects
> should never never be so far out in the presentation layer. i kinda
> agree
> with that. valueObjects should really only be used on the borders of
> layers.
>
> that however brings the question: why should i use something else
> than strings in my actionforms?
>

Except for boolean properties that back a checkbox field, you should NOT
be using other than strings in your form beans.

A form bean is not a value object (as you have described it as being
useful primarily between layers).  Rather, a form bean is the sever side
representation of the state of a particular form submit, and it belongs
solely to the view tier.  People who try to use a form bean as a value
object, IMHO, are making a mistake.

Instead, your Action should accept a validated form bean and copy the
relevant information into a relevant value object.  The
BeanUtils.copyProperties() method is very helpful in performing the needed
type conversions for such situations -- but back end business logic should
NEVER need to import things like org.apache.struts.action.ActionForm.

> ciao!
> florian

Craig McClanahan

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message