Quoting [EMAIL PROTECTED]:

> I think that sounds like a good compromise.  In my view, there are really
> two types of "forms" - small ones with one or two parameters, and full
> blown complex input forms.  In the former case, I think combining the form
> and action is a good idea; the latter, probably not so much.
> 
> In WebWork2/XWork, as I understand it, your action can declare JavaBean
> setters which will be automatically populated by the framework.  This
> makes it very easy to unit test and frees the actions from any servlet
> dependencies.  This approach works very well for actions that require a
> couple of parameters, while I might favor the Struts approach for larger
> forms.
> 

JavaServer Faces supports (but does not require) this idiom as well.  The
corresponding backing beans would typically be defined in <managed-bean>
entries in faces-config.xml so that they get automatically instantiated on
demand (the way that Struts 1.x does for form beans).  The managed bean
configuration entry can also cause properties of the instantiated bean to be
set as well.

One thing I particularly like about the way JSF does this is that the backing
bean class doesn't have to extend a framework base class, or implement a
particular interface.  This makes it fairly straightforward to unit test them,
or use them in different contexts.

> To experiment adding these and other WebWork2/XWork features in Struts we
> started the Struts Action Invocation Framework (SAIF) on struts.sf.net 
> The Struts sf site is a great forum for trying out ideas before sticking
> them in Struts core.  To implement the integrated form/action, we "scope"
> actions (request/session/application), then use action interceptors to set
> action JavaBean setters from the request parameters.  While SAIF certainly
> isn't ready to be put in Struts core, the action interceptor idea is
> showing promise and provides a good alternative to the more heavy-handed
> ActionForm for simplier situations.
> 
> Don
> 

Craig


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

Reply via email to