(From 8/30/2003 struts-user posting by TedHusted.)

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

Newbie FAQ

and

User Guide

  • No labels