org.infohazard.maverick.ctl
Class FormBeanUser

java.lang.Object
  |
  +--org.infohazard.maverick.ctl.FormBeanUser
All Implemented Interfaces:
Controller, ControllerSingleton

public abstract class FormBeanUser
extends java.lang.Object
implements ControllerSingleton

FormBeanUser is a base class for singleton controllers which use external FormBeans rather than populating themselves. Since only one of these will exist for each command definition, it must be thread-safe. This Controller pattern is very similar to Struts Actions.


Field Summary
static java.lang.String ERROR
          Common name for the typical "error" view.
static java.lang.String SUCCESS
          Common name for the typical "success" view.
 
Constructor Summary
FormBeanUser()
           
 
Method Summary
 java.lang.String go(ControllerContext cctx)
          Executes this controller.
 void init(org.jdom.Element controllerNode)
          If you want any custom behavior based on the content of the configuration file, this will be called once before the FormBeanUser is ever used.
protected abstract  java.lang.Object makeFormBean(ControllerContext cctx)
          This method will be called to produce a simple bean whose properties will be populated with the http request parameters.
protected  java.lang.String perform(java.lang.Object formBean, ControllerContext cctx)
          This method can be overriden to perform application logic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUCCESS

public static final java.lang.String SUCCESS
Common name for the typical "success" view.

See Also:
Constant Field Values

ERROR

public static final java.lang.String ERROR
Common name for the typical "error" view.

See Also:
Constant Field Values
Constructor Detail

FormBeanUser

public FormBeanUser()
Method Detail

init

public void init(org.jdom.Element controllerNode)
          throws ConfigException
If you want any custom behavior based on the content of the configuration file, this will be called once before the FormBeanUser is ever used.

Specified by:
init in interface ControllerSingleton
ConfigException
See Also:

go

public final java.lang.String go(ControllerContext cctx)
                          throws javax.servlet.ServletException
Executes this controller. Override one of the other perform() methods to provide application logic.

Specified by:
go in interface Controller
Returns:
which view to switch to
javax.servlet.ServletException
See Also:
ControllerSingleton#perform

perform

protected java.lang.String perform(java.lang.Object formBean,
                                   ControllerContext cctx)
                            throws java.lang.Exception
This method can be overriden to perform application logic. Override this method if you want the model to be something other than the formBean itself.

Parameters:
formBean - will be a bean created by makeFormBean(), which has been populated with the http request parameters.
java.lang.Exception

makeFormBean

protected abstract java.lang.Object makeFormBean(ControllerContext cctx)
This method will be called to produce a simple bean whose properties will be populated with the http request parameters. The parameters are useful for doing things like persisting beans across requests.