Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Excerpt
hiddentrue

Struts ActionForms


ActionForms should not contain business objects because it binds the presentation layer to the model in the business tier. If the model changes, the presentation layer will have to change. Also, the business object should represent the native data types, such as int or Date, and the web client is String-based and can only handle String or boolean data types without a conversion. Also, nesting a mutable business object does not work well if the business object rejects badly formatted data.

(to be explained soon). (What we use to advocate - to be corrected soon..._you can stuff biz objects directly into an ActionForm (and not flatten them out; i.e. you don't need to create fields in the form for each field in the biz object). Struts is able to deal with populating and returning nested objects. For example, you might have a "customer" bean on your ActionForm,_ and then refer to the property "customer.name" in your presentation page. This would correspond to the methods customer.getName() and customer.setName(String Name) on your customer bean. See the Apache Struts Taglib Developer Guides for more about using the nested syntax.)

...