com.mockrunner.struts
Class ActionTestModule

java.lang.Object
  extended bycom.mockrunner.base.WebTestModule
      extended bycom.mockrunner.base.HTMLOutputModule
          extended bycom.mockrunner.struts.ActionTestModule

public class ActionTestModule
extends HTMLOutputModule

Module for Struts action tests. Simulates Struts without reading the struts-config.xml file. Per default this class does everything like Struts when calling an action but you can change the behaviour (e.g. disable form population). Please note: If your action throws an exception, it will be nested in a NestedApplicationException.


Constructor Summary
ActionTestModule(ActionMockObjectFactory mockFactory)
           
 
Method Summary
 org.apache.struts.action.ActionForward actionPerform(org.apache.struts.action.Action action)
          Calls the specified action using no ActionForm.
 org.apache.struts.action.ActionForward actionPerform(org.apache.struts.action.Action action, org.apache.struts.action.ActionForm form)
          Calls the specified action using the specified ActionForm object.
 org.apache.struts.action.ActionForward actionPerform(org.apache.struts.action.Action action, java.lang.Class form)
          Calls the specified action using the ActionForm of the specified type.
 org.apache.struts.action.ActionForward actionPerform(java.lang.Class action)
          Calls the action of the specified type using no ActionForm.
 org.apache.struts.action.ActionForward actionPerform(java.lang.Class action, org.apache.struts.action.ActionForm form)
          Calls the action of the specified type using the specified ActionForm object.
 org.apache.struts.action.ActionForward actionPerform(java.lang.Class action, java.lang.Class form)
          Calls the action of the specified type using the ActionForm of the specified type.
 java.lang.String addMappedPropertyRequestPrefix(java.lang.String property)
          Convinience method for map backed properties.
 org.apache.struts.action.ActionForm createActionForm(java.lang.Class form)
          Creates a new ActionForm object of the specified type and sets it as the current ActionForm.
 org.apache.struts.action.DynaActionForm createDynaActionForm(org.apache.struts.config.FormBeanConfig formConfig)
          Creates a new DynaActionForm based on the specified form config.
 org.apache.commons.validator.ValidatorResources createValidatorResources(java.lang.String[] resourcesFiles)
          Creates a valid ValidatorResources object based on the specified config files.
 void generateValidToken()
          Generates a token and sets it to the session and the request.
 org.apache.struts.action.ActionMessage getActionErrorByKey(java.lang.String errorKey)
          Returns the action error with the specified key or null if such an error does not exist.
 org.apache.struts.action.ActionMessages getActionErrors()
          Get the currently present action errors.
 org.apache.struts.action.ActionMessages getActionErrorsFromRequest()
          Get the currently present action errors from the request.
 org.apache.struts.action.ActionMessages getActionErrorsFromSession()
          Get the currently present action errors from the session.
 org.apache.struts.action.ActionForm getActionForm()
          Returns the currently set ActionForm.
 MockActionForward getActionForward()
          Returns the current ActionForward.
 org.apache.struts.action.ActionMessage getActionMessageByKey(java.lang.String messageKey)
          Returns the action message with the specified key or null if such a message does not exist.
 org.apache.struts.action.ActionMessages getActionMessages()
          Get the currently present action messages.
 org.apache.struts.action.ActionMessages getActionMessagesFromRequest()
          Get the currently present action messages from the request.
 org.apache.struts.action.ActionMessages getActionMessagesFromSession()
          Get the currently present action messages from the session.
 org.apache.struts.action.Action getLastAction()
          Returns the last tested Action object.
 MockActionMapping getMockActionMapping()
          Returns the MockActionMapping passed to the action.
 MockPageContext getMockPageContext()
          Returns the MockPageContext object.
 java.lang.String getOutput()
          Returns the HTML output as a string (if the action creates HTML output).
 boolean hasActionErrors()
          Returns if action errors are present.
 boolean hasActionMessages()
          Returns if action messages are present.
 void populateRequestToForm()
          Populates the current request parameters to the ActionForm.
 void setActionErrors(org.apache.struts.action.ActionMessages errors)
          Sets the specified ActionErrors object as the currently present errors to the request.
 void setActionErrorsToSession(org.apache.struts.action.ActionMessages errors)
          Sets the specified ActionErrors object as the currently present errors to the session.
 void setActionForm(org.apache.struts.action.ActionForm formObj)
          Sets the specified ActionForm object as the current ActionForm.
 void setActionMessages(org.apache.struts.action.ActionMessages messages)
          Sets the specified ActionMessages object as the currently present messages to the request.
 void setActionMessagesToSession(org.apache.struts.action.ActionMessages messages)
          Sets the specified ActionMessages object as the currently present messages to the session.
 void setDataSource(javax.sql.DataSource dataSource)
          Sets the specified DataSource.
 void setDataSource(java.lang.String key, javax.sql.DataSource dataSource)
          Sets the specified DataSource.
 void setDoPopulate(boolean doPopulate)
          Set if the form should be populated with the request parameters before calling the action.
 void setErrorAttributeKey(java.lang.String errorAttributeKey)
          Name of the key under which errors are stored.
 void setInput(java.lang.String input)
          Sets the input attribute.
 void setLocale(java.util.Locale locale)
          Sets the specified locale as a session attribute using Globals.LOCALE_KEY as the key.
 void setMessageAttributeKey(java.lang.String messageAttributeKey)
          Name of the key under which messages are stored.
 void setParameter(java.lang.String parameter)
          Sets the parameter by delegating to ActionConfig.setParameter(java.lang.String).
 void setRecognizeMessagesInSession(boolean recognizeInSession)
          Set if messages that are saved to the session (instead of the request) should be recognized.
 void setReset(boolean reset)
          Set if the reset method should be called before populating a form with populateRequestToForm().
 void setResources(org.apache.struts.util.MessageResources resources)
          Sets the specified messages resources as a request attribute using Globals.MESSAGES_KEY as the key.
 void setResources(java.lang.String key, org.apache.struts.util.MessageResources resources)
          Sets the specified messages resources as a servlet context attribute using the specified key and the module config prefix.
 void setValidate(boolean validate)
          Sets if Form validation should be performed before calling the action.
 void setValidatorResources(org.apache.commons.validator.ValidatorResources validatorResources)
          Sets the specified ValidatorResources.
 void verifyActionErrorNotPresent(java.lang.String errorKey)
          Verifies that an action error with the specified key is not present.
 void verifyActionErrorPresent(java.lang.String errorKey)
          Verifies that an action error with the specified key is present.
 void verifyActionErrorProperty(java.lang.String errorKey, java.lang.String property)
          Verifies that the specified error is stored for the specified property.
 void verifyActionErrors(java.lang.String[] errorKeys)
          Verifies that the specified action errors are present.
 void verifyActionErrorValue(java.lang.String errorKey, java.lang.Object value)
          Verifies the value of the action error with the specified key.
 void verifyActionErrorValues(java.lang.String errorKey, java.lang.Object[] values)
          Verifies the values of the action error with the specified key.
 void verifyActionMessageNotPresent(java.lang.String messageKey)
          Verifies that an action message with the specified key is not present.
 void verifyActionMessagePresent(java.lang.String messageKey)
          Verifies that an action message with the specified key is present.
 void verifyActionMessageProperty(java.lang.String messageKey, java.lang.String property)
          Verifies that the specified message is stored for the specified property.
 void verifyActionMessages(java.lang.String[] messageKeys)
          Verifies that the specified action messages are present.
 void verifyActionMessageValue(java.lang.String messageKey, java.lang.Object value)
          Verifies the value of the action message with the specified key.
 void verifyActionMessageValues(java.lang.String messageKey, java.lang.Object[] values)
          Verifies the values of the action message with the specified key.
 void verifyForward(java.lang.String path)
          Verifies the forward path returned by the action.
 void verifyForwardName(java.lang.String name)
          Verifies the forward name returned by the action.
 void verifyHasActionErrors()
          Verifies that there are action errors present.
 void verifyHasActionMessages()
          Verifies that there are action messages present.
 void verifyNoActionErrors()
          Verifies that there are no action errors present.
 void verifyNoActionMessages()
          Verifies that there are no action messages present.
 void verifyNumberActionErrors(int number)
          Verifies the number of action errors.
 void verifyNumberActionMessages(int number)
          Verifies the number of action messages.
 void verifyRedirect(boolean redirect)
          Verifies the redirect attribute.
 
Methods inherited from class com.mockrunner.base.HTMLOutputModule
getOutputAsBufferedReader, getOutputAsJDOMDocument, getOutputAsW3CDocument, getOutputAsWellformedXML, setCaseSensitive, verifyOutput, verifyOutputContains, verifyOutputRegularExpression
 
Methods inherited from class com.mockrunner.base.WebTestModule
addRequestParameter, addRequestParameter, addRequestParameter, getRequestAttribute, getRequestParameter, getSessionAttribute, setRequestAttribute, setSessionAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionTestModule

public ActionTestModule(ActionMockObjectFactory mockFactory)
Method Detail

setReset

public void setReset(boolean reset)
Set if the reset method should be called before populating a form with populateRequestToForm(). Default is true which is the standard Struts behaviour.

Parameters:
reset - should reset be called

setDoPopulate

public void setDoPopulate(boolean doPopulate)
Set if the form should be populated with the request parameters before calling the action. Default is true which is the standard Struts behaviour.

Parameters:
doPopulate - should population be performed

setRecognizeMessagesInSession

public void setRecognizeMessagesInSession(boolean recognizeInSession)
Set if messages that are saved to the session (instead of the request) should be recognized. Default is true.

Parameters:
recognizeInSession - should messages in the session be recognized

setMessageAttributeKey

public void setMessageAttributeKey(java.lang.String messageAttributeKey)
Name of the key under which messages are stored. Default is Globals.MESSAGE_KEY.

Parameters:
messageAttributeKey - the message key

setErrorAttributeKey

public void setErrorAttributeKey(java.lang.String errorAttributeKey)
Name of the key under which errors are stored. Default is Globals.ERROR_KEY.

Parameters:
errorAttributeKey - the message key

addMappedPropertyRequestPrefix

public java.lang.String addMappedPropertyRequestPrefix(java.lang.String property)
Convinience method for map backed properties. Creates a String value(property).

Parameters:
property - the property
Returns:
the String in map backed propery style

setParameter

public void setParameter(java.lang.String parameter)
Sets the parameter by delegating to ActionConfig.setParameter(java.lang.String). You can test your Actions with different parameter settings in the same test method.

Parameters:
parameter - the parameter

setValidate

public void setValidate(boolean validate)
Sets if Form validation should be performed before calling the action. Delegates to ActionConfig.setValidate(boolean). Default is false.

Parameters:
validate - should validation be performed

setInput

public void setInput(java.lang.String input)
Sets the input attribute. If form validation fails, the input attribute can be verified with verifyForward(java.lang.String). Delegates to ActionConfig.setInput(java.lang.String).

Parameters:
input - the input attribute

setResources

public void setResources(org.apache.struts.util.MessageResources resources)
Sets the specified messages resources as a request attribute using Globals.MESSAGES_KEY as the key. You can use this method, if your action calls Action.getResources(HttpServletRequest). The deprecated method Action.getResources() takes the resources from the servlet context with the same key. If your action uses this method, you have to set the resources manually to the servlet context.

Parameters:
resources - the messages resources

setResources

public void setResources(java.lang.String key,
                         org.apache.struts.util.MessageResources resources)
Sets the specified messages resources as a servlet context attribute using the specified key and the module config prefix. You can use this method, if your action calls Action.getResources(HttpServletRequest, String). Please note that the MockModuleConfig is set by Mockrunner as the current module. It has the name testmodule but this can be changed with ModuleConfig.setPrefix.

Parameters:
key - the key of the messages resources
resources - the messages resources

setDataSource

public void setDataSource(javax.sql.DataSource dataSource)
Sets the specified DataSource. You can use this method, if your action calls Action.getDataSource(HttpServletRequest).

Parameters:
dataSource - DataSource

setDataSource

public void setDataSource(java.lang.String key,
                          javax.sql.DataSource dataSource)
Sets the specified DataSource. You can use this method, if your action calls Action.getDataSource(HttpServletRequest, String).

Parameters:
key - the key of the DataSource
dataSource - DataSource

setLocale

public void setLocale(java.util.Locale locale)
Sets the specified locale as a session attribute using Globals.LOCALE_KEY as the key. You can use this method, if your action calls Action.getLocale(HttpServletRequest).

Parameters:
locale - the locale

createValidatorResources

public org.apache.commons.validator.ValidatorResources createValidatorResources(java.lang.String[] resourcesFiles)
Creates a valid ValidatorResources object based on the specified config files. Since the parsing of the files is time consuming, it makes sense to cache the result. You can set the returned ValidatorResources object with setValidatorResources(org.apache.commons.validator.ValidatorResources). It is then used in all validations.

Parameters:
resourcesFiles - the array of config files

setValidatorResources

public void setValidatorResources(org.apache.commons.validator.ValidatorResources validatorResources)
Sets the specified ValidatorResources. The easiest way to create ValidatorResources is the method createValidatorResources(java.lang.String[]).

Parameters:
validatorResources - the ValidatorResources

verifyForward

public void verifyForward(java.lang.String path)
Verifies the forward path returned by the action. If your action uses mapping.findForward("success") to find the forward, you can use this method or verifyForwardName(java.lang.String) to test the success forward name. If your action creates an ActionForward on its own you can use this method to verify the forward path.

Parameters:
path - the expected path
Throws:
VerifyFailedException - if verification fails

verifyForwardName

public void verifyForwardName(java.lang.String name)
Verifies the forward name returned by the action. If your action uses mapping.findForward("success") to find the forward, you can use this method or verifyForward(java.lang.String) to test the success forward name. If your action creates an ActionForward on its own you can use this method to verify the forward name.

Parameters:
name - the expected name
Throws:
VerifyFailedException - if verification fails

verifyRedirect

public void verifyRedirect(boolean redirect)
Verifies the redirect attribute.

Parameters:
redirect - the expected redirect attribute
Throws:
VerifyFailedException - if verification fails

verifyNoActionErrors

public void verifyNoActionErrors()
Verifies that there are no action errors present.

Throws:
VerifyFailedException - if verification fails

verifyNoActionMessages

public void verifyNoActionMessages()
Verifies that there are no action messages present.

Throws:
VerifyFailedException - if verification fails

verifyHasActionErrors

public void verifyHasActionErrors()
Verifies that there are action errors present.

Throws:
VerifyFailedException - if verification fails

verifyHasActionMessages

public void verifyHasActionMessages()
Verifies that there are action messages present.

Throws:
VerifyFailedException - if verification fails

verifyActionErrorPresent

public void verifyActionErrorPresent(java.lang.String errorKey)
Verifies that an action error with the specified key is present.

Parameters:
errorKey - the expected error key
Throws:
VerifyFailedException - if verification fails

verifyActionMessagePresent

public void verifyActionMessagePresent(java.lang.String messageKey)
Verifies that an action message with the specified key is present.

Parameters:
messageKey - the expected message key
Throws:
VerifyFailedException - if verification fails

verifyActionErrorNotPresent

public void verifyActionErrorNotPresent(java.lang.String errorKey)
Verifies that an action error with the specified key is not present.

Parameters:
errorKey - the error key
Throws:
VerifyFailedException - if verification fails

verifyActionMessageNotPresent

public void verifyActionMessageNotPresent(java.lang.String messageKey)
Verifies that an action message with the specified key is not present.

Parameters:
messageKey - the message key
Throws:
VerifyFailedException - if verification fails

verifyActionErrors

public void verifyActionErrors(java.lang.String[] errorKeys)
Verifies that the specified action errors are present. Regards number and order of action errors.

Parameters:
errorKeys - the array of expected error keys
Throws:
VerifyFailedException - if verification fails

verifyActionMessages

public void verifyActionMessages(java.lang.String[] messageKeys)
Verifies that the specified action messages are present. Regards number and order of action messages.

Parameters:
messageKeys - the array of expected message keys
Throws:
VerifyFailedException - if verification fails

verifyActionErrorValues

public void verifyActionErrorValues(java.lang.String errorKey,
                                    java.lang.Object[] values)
Verifies the values of the action error with the specified key. Regards number and order of values.

Parameters:
errorKey - the error key
values - the exepcted values
Throws:
VerifyFailedException - if verification fails

verifyActionMessageValues

public void verifyActionMessageValues(java.lang.String messageKey,
                                      java.lang.Object[] values)
Verifies the values of the action message with the specified key. Regards number and order of values.

Parameters:
messageKey - the message key
values - the exepcted values
Throws:
VerifyFailedException - if verification fails

verifyActionErrorValue

public void verifyActionErrorValue(java.lang.String errorKey,
                                   java.lang.Object value)
Verifies the value of the action error with the specified key. Fails if the specified value does not match the actual value or if the error has more than one value.

Parameters:
errorKey - the error key
value - the exepcted value
Throws:
VerifyFailedException - if verification fails

verifyActionMessageValue

public void verifyActionMessageValue(java.lang.String messageKey,
                                     java.lang.Object value)
Verifies the value of the action message with the specified key. Fails if the specified value does not match the actual value or if the message has more than one value.

Parameters:
messageKey - the message key
value - the exepcted value
Throws:
VerifyFailedException - if verification fails

verifyActionErrorProperty

public void verifyActionErrorProperty(java.lang.String errorKey,
                                      java.lang.String property)
Verifies that the specified error is stored for the specified property.

Parameters:
errorKey - the error key
property - the exepcted value
Throws:
VerifyFailedException - if verification fails

verifyActionMessageProperty

public void verifyActionMessageProperty(java.lang.String messageKey,
                                        java.lang.String property)
Verifies that the specified message is stored for the specified property.

Parameters:
messageKey - the message key
property - the exepcted value
Throws:
VerifyFailedException - if verification fails

verifyNumberActionErrors

public void verifyNumberActionErrors(int number)
Verifies the number of action errors.

Parameters:
number - the expected number of errors
Throws:
VerifyFailedException - if verification fails

verifyNumberActionMessages

public void verifyNumberActionMessages(int number)
Verifies the number of action messages.

Parameters:
number - the expected number of messages
Throws:
VerifyFailedException - if verification fails

getActionErrorByKey

public org.apache.struts.action.ActionMessage getActionErrorByKey(java.lang.String errorKey)
Returns the action error with the specified key or null if such an error does not exist.

Parameters:
errorKey - the error key
Returns:
the action error with the specified key

getActionMessageByKey

public org.apache.struts.action.ActionMessage getActionMessageByKey(java.lang.String messageKey)
Returns the action message with the specified key or null if such a message does not exist.

Parameters:
messageKey - the message key
Returns:
the action message with the specified key

setActionMessages

public void setActionMessages(org.apache.struts.action.ActionMessages messages)
Sets the specified ActionMessages object as the currently present messages to the request.

Parameters:
messages - the ActionMessages object

setActionMessagesToSession

public void setActionMessagesToSession(org.apache.struts.action.ActionMessages messages)
Sets the specified ActionMessages object as the currently present messages to the session.

Parameters:
messages - the ActionMessages object

getActionMessages

public org.apache.struts.action.ActionMessages getActionMessages()
Get the currently present action messages. Can be called after actionPerform(java.lang.Class) to get the messages the action has set. This method checks the request first. If there are no messages in the request and messages in the session should be recognized (use setRecognizeMessagesInSession(boolean)), it checks the session next.

Returns:
the action messages

getActionMessagesFromRequest

public org.apache.struts.action.ActionMessages getActionMessagesFromRequest()
Get the currently present action messages from the request.

Returns:
the action messages

getActionMessagesFromSession

public org.apache.struts.action.ActionMessages getActionMessagesFromSession()
Get the currently present action messages from the session.

Returns:
the action messages

hasActionMessages

public boolean hasActionMessages()
Returns if action messages are present.

Returns:
true if messages are present, false otherwise

setActionErrors

public void setActionErrors(org.apache.struts.action.ActionMessages errors)
Sets the specified ActionErrors object as the currently present errors to the request.

Parameters:
errors - the ActionErrors object

setActionErrorsToSession

public void setActionErrorsToSession(org.apache.struts.action.ActionMessages errors)
Sets the specified ActionErrors object as the currently present errors to the session.

Parameters:
errors - the ActionErrors object

getActionErrors

public org.apache.struts.action.ActionMessages getActionErrors()
Get the currently present action errors. Can be called after actionPerform(java.lang.Class) to get the errors the action has set. This method checks the request first. If there are no errors in the request and messages in the session should be recognized (use setRecognizeMessagesInSession(boolean)), it checks the session next.

Returns:
the action errors

getActionErrorsFromRequest

public org.apache.struts.action.ActionMessages getActionErrorsFromRequest()
Get the currently present action errors from the request.

Returns:
the action messages

getActionErrorsFromSession

public org.apache.struts.action.ActionMessages getActionErrorsFromSession()
Get the currently present action errors from the session.

Returns:
the action messages

hasActionErrors

public boolean hasActionErrors()
Returns if action errors are present.

Returns:
true if errors are present, false otherwise

getMockActionMapping

public MockActionMapping getMockActionMapping()
Returns the MockActionMapping passed to the action. Can be manipulated before and after actionPerform(java.lang.Class). Delegates to ActionMockObjectFactory.getMockActionMapping().

Returns:
the MockActionMapping

getMockPageContext

public MockPageContext getMockPageContext()
Returns the MockPageContext object. Delegates to WebMockObjectFactory.getMockPageContext().

Returns:
the MockPageContext

getActionForward

public MockActionForward getActionForward()
Returns the current ActionForward. Can be called after actionPerform(java.lang.Class) to get the ActionForward the action has returned.

Returns:
the MockActionForward

getLastAction

public org.apache.struts.action.Action getLastAction()
Returns the last tested Action object.

Returns:
the Action object

generateValidToken

public void generateValidToken()
Generates a token and sets it to the session and the request.


getActionForm

public org.apache.struts.action.ActionForm getActionForm()
Returns the currently set ActionForm.

Returns:
the ActionForm object

setActionForm

public void setActionForm(org.apache.struts.action.ActionForm formObj)
Sets the specified ActionForm object as the current ActionForm. Will be used in next test.

Parameters:
formObj - the ActionForm object

createActionForm

public org.apache.struts.action.ActionForm createActionForm(java.lang.Class form)
Creates a new ActionForm object of the specified type and sets it as the current ActionForm.

Parameters:
form - the Class of the form

createDynaActionForm

public org.apache.struts.action.DynaActionForm createDynaActionForm(org.apache.struts.config.FormBeanConfig formConfig)
Creates a new DynaActionForm based on the specified form config.

Parameters:
formConfig - the FormBeanConfig

populateRequestToForm

public void populateRequestToForm()
Populates the current request parameters to the ActionForm. The form will be reseted before populating if reset is enabled (setReset(boolean). If form validation is enabled (use setValidate(boolean)) the form will be validated after populating it and the appropriate ActionErrors will be set.


actionPerform

public org.apache.struts.action.ActionForward actionPerform(java.lang.Class action)
Calls the action of the specified type using no ActionForm.

Parameters:
action - the Class of the action
Returns:
the resulting ActionForward

actionPerform

public org.apache.struts.action.ActionForward actionPerform(org.apache.struts.action.Action action)
Calls the specified action using no ActionForm.

Parameters:
action - the Action
Returns:
the resulting ActionForward

actionPerform

public org.apache.struts.action.ActionForward actionPerform(java.lang.Class action,
                                                            java.lang.Class form)
Calls the action of the specified type using the ActionForm of the specified type. Creates the appropriate ActionForm and populates it before calling the action (if populating is disabled, the form will not be populated, use setDoPopulate(boolean)). If form validation is enabled (use setValidate(boolean)) and fails, the action will not be called. In this case, the returned ActionForward is based on the input attribute. (Set it with setInput(java.lang.String)).

Parameters:
action - the Class of the action
form - the Class of the form
Returns:
the resulting ActionForward

actionPerform

public org.apache.struts.action.ActionForward actionPerform(org.apache.struts.action.Action action,
                                                            java.lang.Class form)
Calls the specified action using the ActionForm of the specified type. Creates the appropriate ActionForm and populates it before calling the action (if populating is disabled, the form will not be populated, use setDoPopulate(boolean)). If form validation is enabled (use setValidate(boolean)) and fails, the action will not be called. In this case, the returned ActionForward is based on the input attribute. (Set it with setInput(java.lang.String)).

Parameters:
action - the Action
form - the Class of the form
Returns:
the resulting ActionForward

actionPerform

public org.apache.struts.action.ActionForward actionPerform(java.lang.Class action,
                                                            org.apache.struts.action.ActionForm form)
Calls the action of the specified type using the specified ActionForm object. The form will be populated before the action is called (if populating is disabled, the form will not be populated, use setDoPopulate(boolean)). Please note that request parameters will eventually overwrite form values. Furthermore the form will be reseted before populating it. If you do not want that, disable reset using setReset(boolean). If form validation is enabled (use setValidate(boolean)) and fails, the action will not be called. In this case, the returned ActionForward is based on the input attribute. (Set it with setInput(java.lang.String)).

Parameters:
action - the Class of the action
form - the ActionForm object
Returns:
the resulting ActionForward

actionPerform

public org.apache.struts.action.ActionForward actionPerform(org.apache.struts.action.Action action,
                                                            org.apache.struts.action.ActionForm form)
Calls the specified action using the specified ActionForm object. The form will be populated before the action is called (if populating is disabled, the form will not be populated, use setDoPopulate(boolean)). Please note that request parameters will eventually overwrite form values. Furthermore the form will be reseted before populating it. If you do not want that, disable reset using setReset(boolean). If form validation is enabled (use setValidate(boolean)) and fails, the action will not be called. In this case, the returned ActionForward is based on the input attribute. (Set it with setInput(java.lang.String)).

Parameters:
action - the Action
form - the ActionForm object
Returns:
the resulting ActionForward

getOutput

public java.lang.String getOutput()
Returns the HTML output as a string (if the action creates HTML output). Flushes the output before returning it.

Specified by:
getOutput in class HTMLOutputModule
Returns:
the output