org.davesag.generica.controller
Interface FormController

All Superinterfaces:
Controller
All Known Implementing Classes:
AbstractUserProfileController

public interface FormController
extends Controller

FormController implementations provide the core business logic for the Struts forms. By delegating the work to controllers we reduce the complexity of the forms themselves and allow the busines-object to form population logic to be captured in one spot.

FormController s are dynamically loaded by the actions and so updating business logic can be a simple matter of adding a new jar with the right controllers, and updating the struts-config.xml file. Eg:

         <action
                path="/admin/handleeditsitecopy"
                type="org.davesag.generica.servlet.action.HandleUpdateAction"
                parameter="pipe=editsitecopy;
                                        form-controller=com.myapp.controller.SiteCopyController;
                                        action-controller=com.myapp.controller.SiteCopyController;
                                        summary-controller=com.myapp.controller.SiteCopyController"
                name="sitecopy"
                scope="request"
                validate="true"
                input="/admin/editsitecopy.do">
                <forward name="success" path="thanks.editsitecopy.page"/>
        </action>
 
Note in the above example all three controllers are embodied in the same class.

Since:
Generica 1.0
Version:
CVS Revision $Id: FormController.java,v 1.6 2004/04/06 15:40:40 davesag Exp $
Author:
Dave Sag http://www.davesag.com

Method Summary
 Object populateFromForm(Object o)
          Populates the supplied object from the Controller's form.
 void populateWith(Object o)
          Populates the Controller's form with specific information from the supplied object.
 
Methods inherited from interface org.davesag.generica.controller.Controller
setForm, setRequest, setResponse
 

Method Detail

populateWith

public void populateWith(Object o)
Populates the Controller's form with specific information from the supplied object.

Parameters:
o - The Object to use to populate this form.

populateFromForm

public Object populateFromForm(Object o)
Populates the supplied object from the Controller's form.

Parameters:
o - The Object to populate with data from the from.
Returns:
The populated object.


Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.