|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwebwork.action.ActionSupport
This is a useful base class for WebWork Action implementations. It gives you access to a set of useful functionality, including result view mapping, error handling, and i18n.
It is also possible to use this class by way of delegation instead of subclassing. This is useful in the case that your action cannot use subclassing to add functionality
Action
,
Serialized FormField Summary | |
protected java.lang.String |
command
|
protected java.util.Map |
errorMap
|
protected java.util.Collection |
errorMessages
|
protected org.apache.commons.logging.Log |
log
|
Fields inherited from interface webwork.action.Action |
ERROR, INPUT, LOGIN, NONE, SUCCESS |
Constructor Summary | |
ActionSupport()
|
Method Summary | |
void |
addError(java.lang.String fieldName,
java.lang.String errorMessage)
This method is used to attach an error message to a particular form field. |
void |
addErrorMessage(java.lang.String anErrorMessage)
Add an error message to this action |
void |
addIllegalArgumentException(java.lang.String fieldName,
java.lang.IllegalArgumentException e)
|
java.lang.String |
doDefault()
"default" command |
protected java.lang.String |
doExecute()
|
protected void |
doValidation()
Subclasses may override this method to provide validation of input data. |
java.lang.String |
execute()
Execute will first check the request for a result exception. |
protected java.lang.String |
getActionName()
This is used to get the current action's class name |
java.util.Collection |
getErrorMessages()
Get the list of error messages for this action |
java.util.Map |
getErrors()
Get the field specific errors associated with this action. |
boolean |
getHasErrorMessages()
Check whether there are any error messages |
boolean |
getHasErrors()
Check whether there are any errors associated with this action. |
java.util.Locale |
getLocale()
Get the locale for this action. |
protected java.lang.String |
getPropertyEditorMessage(java.lang.String fieldName,
PropertyEditorException pe)
This method is called from addIllegalArgumentException and it should return an error message (that may be localized). |
java.lang.String |
getText(java.lang.String aTextName)
Get a text from the resource bundles associated with this action. |
java.util.ResourceBundle |
getTexts()
Get the resource bundle associated with this action. |
java.util.ResourceBundle |
getTexts(java.lang.String aBundleName)
Get the named bundle. |
boolean |
invalidInput()
Check whether there are any error messages. |
protected java.lang.String |
invokeCommand()
Invokes an alternate execution path for the action. |
boolean |
isCommand(java.lang.String aName)
Detect whether a particular command has been issued |
void |
setCommand(java.lang.String command)
Support implementation of CommandDriven interface. |
void |
setErrorMessages(java.util.Collection errorMessages)
|
void |
setErrors(java.util.Map errorMap)
|
protected void |
validate()
Do validation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected transient org.apache.commons.logging.Log log
protected java.util.Map errorMap
protected java.util.Collection errorMessages
protected java.lang.String command
Constructor Detail |
public ActionSupport()
Method Detail |
public void addIllegalArgumentException(java.lang.String fieldName, java.lang.IllegalArgumentException e)
addIllegalArgumentException
in interface IllegalArgumentAware
protected java.lang.String getPropertyEditorMessage(java.lang.String fieldName, PropertyEditorException pe)
public void setCommand(java.lang.String command)
CommandDriven
public boolean isCommand(java.lang.String aName)
public java.lang.String execute() throws java.lang.Exception
execute
in interface Action
java.lang.Exception
- thrown if a system level exception occurs.
Application level exceptions should be handled by returning
an error value, such as Action.ERROR.public java.lang.String doDefault() throws java.lang.Exception
java.lang.Exception
public java.util.Collection getErrorMessages()
public void setErrorMessages(java.util.Collection errorMessages)
public boolean getHasErrorMessages()
public void addErrorMessage(java.lang.String anErrorMessage)
anErrorMessage
- public void addError(java.lang.String fieldName, java.lang.String errorMessage)
fieldName
- name of fielderrorMessage
- the error messagepublic java.util.Map getErrors()
public void setErrors(java.util.Map errorMap)
public boolean getHasErrors()
public java.util.Locale getLocale()
public java.util.ResourceBundle getTexts(java.lang.String aBundleName)
aBundleName
- bundle name
public java.util.ResourceBundle getTexts()
public java.lang.String getText(java.lang.String aTextName)
aTextName
- name of text to be found
protected java.lang.String doExecute() throws java.lang.Exception
java.lang.Exception
protected void doValidation()
If any application errors arise these should be registered by calling addErrorMessage or addError .
If the validation is dependent on whether a command has been issued, and what that command is, then the isCommand() method should be used.
protected void validate() throws ResultException
ResultException
public boolean invalidInput()
protected java.lang.String invokeCommand() throws java.lang.Exception
java.lang.Exception
protected java.lang.String getActionName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |