org.apache.struts.chain.commands
Class AbstractPopulateActionForm

java.lang.Object
  extended by org.apache.struts.chain.commands.ActionCommandBase
      extended by org.apache.struts.chain.commands.AbstractPopulateActionForm
All Implemented Interfaces:
org.apache.commons.chain.Command, ActionCommand
Direct Known Subclasses:
PopulateActionForm

public abstract class AbstractPopulateActionForm
extends ActionCommandBase

Populate the form bean (if any) for this request.

Version:
$Rev: 471754 $ $Date: 2005-11-12 13:01:44 -0500 (Sat, 12 Nov 2005) $

Field Summary
 
Fields inherited from interface org.apache.commons.chain.Command
CONTINUE_PROCESSING, PROCESSING_COMPLETE
 
Constructor Summary
AbstractPopulateActionForm()
           
 
Method Summary
 boolean execute(ActionContext actionCtx)
          Populate the form bean (if any) for this request.
protected  void handleCancel(ActionContext context, ActionConfig actionConfig, ActionForm actionForm)
          Take into account whether the request includes any defined value for the global "cancel" parameter.
protected abstract  void populate(ActionContext context, ActionConfig actionConfig, ActionForm actionForm)
           Populate the given ActionForm with request parameter values, taking into account any prefix/suffix values configured on the given ActionConfig.
protected abstract  void reset(ActionContext context, ActionConfig actionConfig, ActionForm actionForm)
          Call the reset() method on the specified form bean.
protected  java.lang.String trimParameterName(ActionConfig actionConfig, java.lang.String name)
          For a given request parameter name, trim off any prefix and/or suffix which are defined in actionConfig and return what remains.
 
Methods inherited from class org.apache.struts.chain.commands.ActionCommandBase
execute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPopulateActionForm

public AbstractPopulateActionForm()
Method Detail

execute

public boolean execute(ActionContext actionCtx)
                throws java.lang.Exception

Populate the form bean (if any) for this request.

Specified by:
execute in interface ActionCommand
Specified by:
execute in class ActionCommandBase
Parameters:
actionCtx - The Context for the current request
Returns:
false so that processing continues
Throws:
java.lang.Exception - On an unexpected error

reset

protected abstract void reset(ActionContext context,
                              ActionConfig actionConfig,
                              ActionForm actionForm)

Call the reset() method on the specified form bean.

Parameters:
context - The context for this request
actionConfig - The actionConfig for this request
actionForm - The form bean for this request

populate

protected abstract void populate(ActionContext context,
                                 ActionConfig actionConfig,
                                 ActionForm actionForm)
                          throws java.lang.Exception

Populate the given ActionForm with request parameter values, taking into account any prefix/suffix values configured on the given ActionConfig.

Parameters:
context - The ActionContext we are processing
actionConfig - The ActionConfig we are processing
actionForm - The ActionForm we are processing
Throws:
java.lang.Exception - On an unexpected error

trimParameterName

protected java.lang.String trimParameterName(ActionConfig actionConfig,
                                             java.lang.String name)

For a given request parameter name, trim off any prefix and/or suffix which are defined in actionConfig and return what remains. If either prefix or suffix is defined, then return null for name values which do not begin or end accordingly.

Parameters:
actionConfig - The ActionConfig we are processing
name - The request parameter name to proceess
Returns:
The request parameter name trimmed of any suffix or prefix

handleCancel

protected void handleCancel(ActionContext context,
                            ActionConfig actionConfig,
                            ActionForm actionForm)
                     throws java.lang.Exception

Take into account whether the request includes any defined value for the global "cancel" parameter.

An issue was raised (but I don't think a Bugzilla ticket created) about the security implications of using a well-known cancel property which skips form validation, as you may not write your actions to deal with the cancellation case.

Parameters:
context - The ActionContext we are processing
actionConfig - The ActionConfig we are processing
actionForm - The ActionForm we are processing
Throws:
java.lang.Exception - On an unexpected error
See Also:
Globals.CANCEL_PROPERTY, Globals.CANCEL_PROPERTY_X


Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.