public class CopyFormToContext extends ActionCommandBase
Subclass this command and configure it as part of a per-forward chain to perform any necessary pre-population or other preparation for a form before control is dispatched to the view layer.
Constructor and Description |
---|
CopyFormToContext() |
Modifier and Type | Method and Description |
---|---|
boolean |
execute(ActionContext actionContext)
Look up an ActionForm instance based on the configured properties of
this command and copy it into the
Context . |
protected ActionForm |
findOrCreateForm(ActionContext context)
Based on the properties of this command and the given
ActionContext , find or create an ActionForm instance for
preparation. |
protected ActionForm |
findOrCreateForm(ActionContext ctx,
java.lang.String effectiveFormName,
java.lang.String effectiveScope)
Actually find or create an instance of ActionForm configured under
the form-bean-name
effectiveFormName , looking in in the
ActionContext's scope as identified by
effectiveScope . |
java.lang.String |
getActionPath()
Return ActionPath property.
|
java.lang.String |
getFormName()
Return FormName property.
|
java.lang.String |
getScope()
Return Scope property.
|
java.lang.String |
getToKey()
Return ToKey property.
|
void |
setActionPath(java.lang.String actionPath)
Set ActionPath property.
|
void |
setFormName(java.lang.String formName)
Set FormName property.
|
void |
setScope(java.lang.String scope)
Set Scope property.
|
void |
setToKey(java.lang.String toKey)
Set ToKey property.
|
execute
public java.lang.String getActionPath()
Return ActionPath property.
public void setActionPath(java.lang.String actionPath)
Set ActionPath property.
actionPath
- New valuefor ActionPathpublic java.lang.String getFormName()
Return FormName property.
public void setFormName(java.lang.String formName)
Set FormName property.
formName
- New valuefor FormNamepublic java.lang.String getScope()
Return Scope property.
public void setScope(java.lang.String scope)
Set Scope property.
scope
- New valuefor Scopepublic java.lang.String getToKey()
Return ToKey property.
public void setToKey(java.lang.String toKey)
Set ToKey property.
toKey
- New valuefor FormNamepublic boolean execute(ActionContext actionContext) throws java.lang.Exception
Look up an ActionForm instance based on the configured properties of
this command and copy it into the Context
. After this
command successfully executes, an ActionForm instance will exist in the
specified scope and will be available, for example for backing fields
in an HTML form. It will also be in the ActionContext
available for another command to do prepopulation of values or other
preparation.
execute
in interface ActionCommand
execute
in class ActionCommandBase
actionContext
- Our ActionContextjava.lang.Exception
- on any errorprotected ActionForm findOrCreateForm(ActionContext context) throws java.lang.IllegalAccessException, java.lang.InstantiationException
Based on the properties of this command and the given
ActionContext
, find or create an ActionForm instance for
preparation.
context
- ActionContextBase class that we are processingjava.lang.IllegalArgumentException
- On ActionConfig not foundjava.lang.IllegalStateException
- On undefined scope and formbeanjava.lang.IllegalAccessException
- On failed instantiationjava.lang.InstantiationException
- If ActionContext is not subsclass of
ActionContextBaseprotected ActionForm findOrCreateForm(ActionContext ctx, java.lang.String effectiveFormName, java.lang.String effectiveScope) throws java.lang.IllegalAccessException, java.lang.InstantiationException
Actually find or create an instance of ActionForm configured under
the form-bean-name effectiveFormName
, looking in in the
ActionContext's
scope as identified by
effectiveScope
. If a form is created, it will also be
stored in that scope.
NOTE: This specific method depends on the instance of
ActionContext
which is passed being a subclass of
ActionContextBase
, which implements the utility method
findOrCreateActionForm
.
ctx
- The ActionContext we are processingeffectiveFormName
- the target form nameeffectiveScope
- The target scopejava.lang.InstantiationException
- If ActionContext is not subsclass of
ActionContextBasejava.lang.InstantiationException
- If object cannot be createdjava.lang.IllegalArgumentException
- On form not found in/ scopejava.lang.IllegalAccessException
- On failed instantiationjava.lang.IllegalStateException
- If ActionContext is not a subclass of
ActionBaseCopyright © 2000–2024 Apache Software Foundation. All rights reserved.