struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alok Rajkumar Gupta" <alok.gu...@wipro.com>
Subject Threading issues
Date Mon, 10 Feb 2003 08:02:05 GMT

In case of Action Objects what are the threading issues expected.

Regards
Alok Gupta

-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org] 
Sent: Monday, February 10, 2003 12:56 PM
To: Kashinath
Cc: Struts Users Mailing List
Subject: Re: Model and Controller Components




On Mon, 10 Feb 2003, Kashinath wrote:

> Date: Mon, 10 Feb 2003 11:25:45 -0000
> From: Kashinath <kasinath@visualsoft-tech.com>
> To: Craig R. McClanahan <craigmcc@apache.org>,
>      Struts Users Mailing List <struts-user@jakarta.apache.org>
> Subject: Re: Model and Controller Components
>
> thanks a lot Craig for your information.
> Craig what is your view on ActionForm as Model.
> Is it a model?

Absolutely *not*.  As the original creator of Struts, who designed it
the way it is for a reason, I hope you will take this statement
seriously.

ActionForm is part of the view tier -- it's only purpose in life is to
represent the server-side state of the current values that the user has
typed on an input form.  For example, consider a field that (in your
database) is an integer.  What should happen if the user types "1a3"
instead of "123" into the corresponding text field?

* The validation checking should catch this problem and
  create an appropriate error message.

* The input page should be redisplayed (along with the
  error messages, *including* the "1a3" value that the
  user originally entered.  That is the way GUI programs
  work, and that is what webapp users expect as well.

In order to accomplish this, Struts strongly recommends that the
JavaBean property for an integer field in your ActionForm bean should be
a String
-- that's the only way you can reproduce exactly what the user
originally typed if he or she makes a mistake.

In your Action that processes the input form, after validations have
proven that you can successfully convert this String into an integer,
*that* is where you should convert to native datatypes in a value object
(or whatever other mechanism you are using to communicate with your
business logic).  Investigate the BeanUtils.copyProperties() method for
painless copy-and-convert functionality of all the properties in a form
bean into corresponding native properties in a value object.

For lots and lots more information about this topic, you can search the
mailing list archives for discussions of ActionForm and the three tiers,
or read any of the recent books about Struts.

If you find documentation in Struts that talks about form beans being
model objects, please point them out specifically -- that documentation
is wrong, and needs to be corrected.

> kasi

Craig McClanahan

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


**************************Disclaimer************************************

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individual
 or entity to which it is addressed. You are notified that any use, copying 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***************************************************************************

---------------------------------------------------------------------
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