Yan Zhu wrote:
> I think Struts is slightly forcing some of the issues, consequently making
> things less flexible. This approach would work wonderfully for
> simpler projects, but I am not sure when the scope of the project
> increases.

Couple of quick points.

Struts doesn't require the use of ActionForms. The request is also
available Action perform, and so any common technique can be used. 

There does not need to be a 1:1 relationship between a HTML form and an
ActionForm. All that is really needed is a form with properties that
represent each HTML control. How many or how few ActionForm classes are
used is up to the developer. Struts doesn't care :)

The properties of the ActionForm serve as buffers to the HTML controls.
This allows data to be captured, validated, and possibly corrected
before it is passed to an object that normally expect valid data. 

The ActionMapping (and Request) are passed to the standard reset and
validate methods. This can let you adapt the reset and validate tasks to
the ActionMapping at hand. 

Other bean types can be nested on an ActionForm, if you like, and
accessed through the dotted syntax. 

In the nightly build, you can use a Map to store the properties of an
ActionForm. 

On the ActionForm, define these methods to access your map: 

public void setProperty(String key, Object value)
public Object getProperty(String key)

then you can use this notation in the JavaServer Pages

<html:text property="property(key)"/>

and 

<bean:write name="formBean" property="property(key)"/>

HTH

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/

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

Reply via email to