Hello All,

I just want to confirm what seems to be alluded to in some of the documentation regarding ActionForms.

Is it appropriate or recommended to have properties in an ActionForm that are not to be taken from the request?

For instance, I'm using my ActionForm to "carry" data from the Action back to the JSP. These data originated in the business object, not the request, and are held in beans themselves.

I'm assuming that this is a better strategy than simply putting the business object-supplied beans into the request or session scopes.

Thanks for the advice!

-- john


Ted Husted wrote:
When discussing patterns, like "View Helper" and "Context", it's important to remember that these are *patterns* not architectural elements. In an implementation, a class will often use several patterns.

An ActionForm is both a Context and a View Helper. It's a Context when the Request Processor passes it to the Action, and a View Helper when the ActionServlet passes it back to the Server Page.

From a Core J2EE Patterns Catalog perspective, Struts is most like a Service to Worker. It combines several simpler patterns, like Front Controller, Application Controller, and View Helper. But in each case, more than one class is used to fulfill each of these roles. The ActionServlet and Request Processor serve as the Front Controller, the ActionMappings and Actions comprise an Application Controller, and the ActionForm and Server Page (with any associated taglibs or tools) act as the View Helper.

An ActionForm may represent *input* that a business object requires, but an ActionForm is not itself a business object. As it stands, Actions and ActionForms are coupled to Struts and the web layer and should not thought of as proper business classes.

For more about ActionForms generally, see

http://jakarta.apache.org/struts/faqs/newbie.html#actionForms

and

http://jakarta.apache.org/struts/userGuide/building_controller.html#action_form_classes


-Ted.


Yansheng Lin wrote:

In J2EE pattern catalog, where does an ActionForm Bean fit in? I thought it was
a Business Object, but then what is a view helper and a context object? A
decorator?


Thanks!





--
=====================================================
John Cartwright
Associate Scientist
Geospatial Data Services Group
CIRES, National Geophysical Data Center/NOAA
(303) 497-6284
[EMAIL PROTECTED]
=====================================================



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to