Você está na página 1de 19

Type of Action in Struts:

ForwardAction:
An Action that forwards to the context-relative URI specified by the parameter property of our
associated ActionMapping. This can be used to integrate Struts with other business logic
components that are implemented as servlets (or JSP pages), but still take advantage of the Struts
controller servlet's functionality (such as processing of form beans).
To configure the use of this Action in your struts-config.xml file, create an entry like this:
<action path="/saveSubscription" type="org.apache.struts.actions.ForwardAction"
name="subscriptionForm" scope="request" input="/subscription.jsp"
parameter="/path/to/processing/servlet"/>
which will forward control to the context-relative URI specified by the parameter attribute.
IncludeAction:
public class IncludeAction extends BaseAction
An Action that includes the context-relative URI specified by the parameter property of our
associated ActionMapping. This can be used to integrate Struts with other business logic
components that are implemented as servlets (or JSP pages), but still take advantage of the Struts
controller servlet's functionality (such as processing of form beans).
To configure the use of this Action in your struts-config.xml file, create an entry like this:
<action path="/saveSubscription" type="org.apache.struts.actions.IncludeAction"
name="subscriptionForm" scope="request" input="/subscription.jsp"
parameter="/path/to/processing/servlet">
which will include the context-relative URI specified by the parameter attribute.
Like <include > in jsp.
DispatchAction:
public abstract class DispatchAction extends BaseAction
An abstract Action that dispatches to a public method that is named by the request parameter
whose name is specified by the parameter property of the corresponding ActionMapping. This
Action is useful for developers who prefer to combine many similar actions into a single Action class,
in order to simplify their application design.
To configure the use of this action in your struts-config.xml file, create an entry like this:
<action path="/saveSubscription" type="org.apache.struts.actions.DispatchAction"
name="subscriptionForm" scope="request" input="/subscription.jsp" parameter="method"/>
which will use the value of the request parameter named "method" to pick the appropriate
"execute" method, which must have the same signature (other than method name) of the standard
Action.execute method. For example, you might have the following three methods in the same
action:
public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest
request, HttpServletResponse response) throws Exception
public ActionForward insert(ActionMapping mapping, ActionForm form, HttpServletRequest
request, HttpServletResponse response) throws Exception
public ActionForward update(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception
and call one of the methods with a URL like this:
http://localhost:8080/myapp/saveSubscription.do?method=update
LookupDispatchAction:
public abstract class LookupDispatchAction extends DispatchAction
An abstract Action that dispatches to the subclass mapped execute method. This is useful in cases
where an HTML form has multiple submit buttons with the same name. The button name is specified
by the parameter property of the corresponding ActionMapping. To configure the use of this action
in your struts-config.xml file, create an entry like this:
<action path="/test"
type="org.example.MyAction"
name="MyForm"
scope="request"
input="/test.jsp"
parameter="method"/>
which will use the value of the request parameter named "method" to locate the corresponding key
in ApplicationResources. For example, you might have the following
ApplicationResources.properties:
button.add=Add Record
button.delete=Delete Record
And your JSP would have the following format for submit buttons:
<html:form action="/test">
<html:submit property="method">
<bean:message key="button.add"/>
</html:submit>
<html:submit property="method">
<bean:message key="button.delete"/>
</html:submit>
</html:form>
Your subclass must implement both getKeyMethodMap and the methods defined in the map. An
example of such implementations are:
protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("button.add", "add");
map.put("button.delete", "delete");
return map;
}
public ActionForward add(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
// do add
return mapping.findForward("success");
}
public ActionForward delete(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
return mapping.findForward("success"); }
Notes - If duplicate values exist for the keys returned by getKeys, only the first one found will be
returned. If no corresponding key is found then an exception will be thrown. You can override the
method unspecified to provide a custom handler. If the submit was cancelled (a html:cancel button
was pressed), the custom handler cancelled will be used instead.
getKeyMethodMap
protected abstract Map getKeyMethodMap()
Provides the mapping from resource key to method name.
Returns:
Resource key / method name map.
EventDispatchAction:
public class EventDispatchAction extends DispatchAction
An Action that dispatches to to one of the public methods that are named in the parameter attribute
of the corresponding ActionMapping and matches a submission parameter. This is useful for
developers who prefer to use many submit buttons, images, or submit links on a single form and
whose related actions exist in a single Action class.
The method(s) must have the same signature (other than method name) of the standard
Action.execute method.
To configure the use of this action in your struts-config.xml file, create an entry like this:
<action path="/saveSubscription"
type="org.example.SubscriptionAction"
name="subscriptionForm"
scope="request"
input="/subscription.jsp"
parameter="save,back,recalc=recalculate,default=save"/>
where parameter contains three possible methods and one default method if nothing matches (such
as the user pressing the enter key).
For utility purposes, you can use the key=value notation to alias methods so that they are exposed
as different form element names, in the event of a naming conflict or otherwise. In this example, the
recalc button (via a request parameter) will invoke the recalculate method. The security-minded
person may find this feature valuable to obfuscate and not expose the methods.
The default key is purely optional. If this is not specified and no parameters match the list of method
keys, null is returned which means the unspecified method will be invoked.
The order of the parameters are guaranteed to be iterated in the order specified. If multiple buttons
were accidently submitted, the first match in the list will be dispatched.
Since:
Struts 1.2.9

MappingDispatchAction:
public class MappingDispatchAction extends DispatchAction
An abstract Action that dispatches to a public method that is named by the parameter attribute of
the corresponding ActionMapping. This is useful for developers who prefer to combine many related
actions into a single Action class.
To configure the use of this action in your struts-config.xml file, create an entry like this:
<action path="/saveSubscription"
type="org.example.SubscriptionAction"
name="subscriptionForm"
scope="request"
input="/subscription.jsp"
parameter="method"/>
where 'method' is the name of a method in your subclass of MappingDispatchAction that has the
same signature (other than method name) of the standard Action.execute method. For example, you
might combine the methods for managing a subscription into a single MappingDispatchAction class
using the following methods:
public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest
request, HttpServletResponse response) throws Exception
public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest
request, HttpServletResponse response) throws Exception
public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest
request, HttpServletResponse response) throws Exception
public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest
request, HttpServletResponse response) throws Exception
public ActionForward list(ActionMapping mapping, ActionForm form, HttpServletRequest
request, HttpServletResponse response) throws Exception
for which you would create corresponding <action> configurations that reference this class:
<action path="/createSubscription"
type="org.example.SubscriptionAction"
parameter="create">
<forward name="success" path="/editSubscription.jsp"/>
</action>

<action path="/editSubscription"
type="org.example.SubscriptionAction"
parameter="edit">
<forward name="success" path="/editSubscription.jsp"/>
</action>

<action path="/saveSubscription"
type="org.example.SubscriptionAction"
parameter="save"
name="subscriptionForm"
validate="true"
input="/editSubscription.jsp"
scope="request">
<forward name="success" path="/savedSubscription.jsp"/>
</action>
<action path="/deleteSubscription"
type="org.example.SubscriptionAction"
name="subscriptionForm"
scope="request"
input="/subscription.jsp"
parameter="delete">
<forward name="success" path="/deletedSubscription.jsp"/>
</action>

<action path="/listSubscriptions"
type="org.example.SubscriptionAction"
parameter="list">
<forward name="success" path="/subscriptionList.jsp"/>
</action>
NOTE - Unlike DispatchAction, mapping characteristics may differ between the various handlers, so
you can combine actions in the same class that, for example, differ in their use of forms or
validation. Also, a request parameter, which would be visible to the application user, is not required
to enable selection of the handler method.
Since:
Struts 1.2
unspecified
protected org.apache.struts.action.ActionForward
unspecified(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
Method which is dispatched to when there is no value for the parameter in the
ActionMapping. Subclasses of MappingDispatchAction should override this method if they
wish to provide default behavior different than throwing a ServletException.
Overrides:
unspecified in class DispatchAction
Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The HTTP request we are processing
response - The HTTP response we are creating
Returns:
Return an ActionForward instance describing where and how control should be forwarded,
or null if the response has already been completed.
Throws:
Exception - if an exception occurs
DownloadAction:
public abstract class DownloadAction
extends BaseAction
This is an abstract base class that minimizes the amount of special coding that needs to be written to
download a file. All that is required to use this class is to extend it and implement the
getStreamInfo() method so that it returns the relevant information for the file (or other stream) to
be downloaded. Optionally, the getBufferSize() method may be overridden to customize the size of
the buffer used to transfer the file.
Since:
Struts 1.2.6

LocaleAction:

public final class LocaleAction extends BaseAction
Implementation of Action that changes the user's Locale and forwards to a page, based on request
level parameters that are set (language, country, & page).
public org.apache.struts.action.ActionForward
execute(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
Change the user's Locale based on ActionForm properties.
This Action looks for language and country properties on the given form, constructs an
appropriate Locale object, and sets it as the Struts Locale for this user's session. Any
ActionForm, including a DynaActionForm, may be used.
If a page property is also provided, then after setting the Locale, control is forwarded to that
URI path. Otherwise, control is forwarded to "success".
Overrides:
execute in class org.apache.struts.action.Action
Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The HTTP request we are processing
response - The HTTP response we are creating
Returns:
Action to forward to
Throws:
Exception - if an input/output error or servlet exception occurs
















ActionDispatcher:
public class ActionDispatcher extends Object
Action helper class that dispatches to a public method in an Action.
This class is provided as an alternative mechanism to using DispatchAction and its various flavours
and means Dispatch behaviour can be easily implemented into any Action without having to inherit
from a particular super Action.
To implement dispatch behaviour in an Action class, create your custom Action as follows, along
with the methods you require (and optionally "cancelled" and "unspecified" methods):
public class MyCustomAction extends Action {

protected ActionDispatcher dispatcher
= new ActionDispatcher(this, ActionDispatcher.MAPPING_FLAVOR);

public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
return dispatcher.execute(mapping, form, request, response);
}
}

It provides three flavours of determing the name of the method:
DEFAULT_FLAVOR - uses the parameter specified in the struts-config.xml to get the method
name from the Request (equivalent to DispatchAction except uses "method" as a default if
the parameter is not specified in the struts-config.xml).
DISPATCH_FLAVOR - uses the parameter specified in the struts-config.xml to get the
method name from the Request (equivalent to DispatchAction).
MAPPING_FLAVOR - uses the parameter specified in the struts-config.xml as the method
name (equivalent to MappingDispatchAction).
Since:
Struts 1.2.7
execute
public org.apache.struts.action.ActionForward
execute(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
Process the specified HTTP request, and create the corresponding HTTP response (or
forward to another web component that will create it). Return an ActionForward instance
describing where and how control should be forwarded, or null if the response has already
been completed.
Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The HTTP request we are processing
response - The HTTP response we are creating
Returns:
The forward to which control should be transferred, or null if the response has been
completed.
Throws:
Exception - if an exception occurs
unspecified
protected org.apache.struts.action.ActionForward
unspecified(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
Dispatches to the target class' unspecified method, if present, otherwise throws a
ServletException. Classes utilizing ActionDispatcher should provide an unspecified method if
they wish to provide behavior different than throwing a ServletException.
Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The non-HTTP request we are processing
response - The non-HTTP response we are creating
Returns:
The forward to which control should be transferred, or null if the response has been
completed.
Throws:
Exception - if the application business logic throws an exception.
cancelled
protected org.apache.struts.action.ActionForward
cancelled(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
Dispatches to the target class' cancelled method, if present, otherwise returns null. Classes
utilizing ActionDispatcher should provide a cancelled method if they wish to provide
behavior different than returning null.
Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The non-HTTP request we are processing
response - The non-HTTP response we are creating
Returns:
The forward to which control should be transferred, or null if the response has been
completed.
Throws:
Exception - if the application business logic throws an exception.
dispatchMethod
protected org.apache.struts.action.ActionForward
dispatchMethod(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
String name)
throws Exception
Dispatch to the specified method.
Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The non-HTTP request we are processing
response - The non-HTTP response we are creating
name - The name of the method to invoke
Returns:
The forward to which control should be transferred, or null if the response has been
completed.
Throws:
Exception - if the application business logic throws an exception.
dispatchMethod
protected org.apache.struts.action.ActionForward
dispatchMethod(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
String name,
Method method)
throws Exception
Dispatch to the specified method.
Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The non-HTTP request we are processing
response - The non-HTTP response we are creating
name - The name of the method to invoke
method - The method to invoke
Returns:
The forward to which control should be transferred, or null if the response has been
completed.
Throws:
Exception - if the application business logic throws an exception.

EventActionDispatcher

public class EventActionDispatcher
extends ActionDispatcher
An Action helper class that dispatches to to one of the public methods that are named in the
parameter attribute of the corresponding ActionMapping and matches a submission parameter. This
is useful for developers who prefer to use many submit buttons, images, or submit links on a single
form and whose related actions exist in a single Action class.
The method(s) in the associated Action must have the same signature (other than method name) of
the standard Action.execute method.
To configure the use of this action in your struts-config.xml file, create an entry like this:

<action path="/saveSubscription"
type="org.example.SubscriptionAction"
name="subscriptionForm"
scope="request"
input="/subscription.jsp"
parameter="save,back,recalc=recalculate,default=save"/>

where parameter contains three possible methods and one default method if nothing matches (such
as the user pressing the enter key).
For utility purposes, you can use the key=value notation to alias methods so that they are exposed
as different form element names, in the event of a naming conflict or otherwise. In this example, the
recalc button (via a request parameter) will invoke the recalculate method. The security-minded
person may find this feature valuable to obfuscate and not expose the methods.
The default key is purely optional. If this is not specified and no parameters match the list of method
keys, null is returned which means the unspecified method will be invoked.
The order of the parameters are guaranteed to be iterated in the order specified. If multiple buttons
were accidently submitted, the first match in the list will be dispatched.
To implement this dispatch behaviour in an Action, class create your custom Action as follows, along
with the methods you require (and optionally "cancelled" and "unspecified" methods):
public class MyCustomAction extends Action {

protected ActionDispatcher dispatcher = new EventActionDispatcher(this);

public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
return dispatcher.execute(mapping, form, request, response);
}
}

Since:
Struts 1.2.9


Form Bean in Struts:
ActionForm:
public abstract class ActionForm extends Object implements Serializable
An ActionForm is a JavaBean optionally associated with one or more ActionMappings. Such a bean
will have had its properties initialized from the corresponding request parameters before the
corresponding Action.execute method is called.
When the properties of this bean have been populated, but before the execute method of the
Action is called, this bean's validate method will be called, which gives the bean a chance to verify
that the properties submitted by the user are correct and valid. If this method finds problems, it
returns an error messages object that encapsulates those problems, and the controller servlet will
return control to the corresponding input form. Otherwise, the validate method returns null,
indicating that everything is acceptable and the corresponding Action.execute method should be
called.
This class must be subclassed in order to be instantiated. Subclasses should provide property getter
and setter methods for all of the bean properties they wish to expose, plus override any of the public
or protected methods for which they wish to provide modified functionality.
Because ActionForms are JavaBeans, subclasses should also implement Serializable, as required by
the JavaBean specification. Some containers require that an object meet all JavaBean requirements
in order to use the introspection API upon which ActionForms rely.
reset
public void reset(ActionMapping mapping,
HttpServletRequest request)
Can be used to reset bean properties to their default state, as needed. This method is called before
the properties are repopulated by the controller.
The default implementation does nothing. In practice, the only properties that need to be reset are
those which represent checkboxes on a session-scoped form. Otherwise, properties can be given
initial values where the field is declared.
If the form is stored in session-scope so that values can be collected over multiple requests (a
"wizard"), you must be very careful of which properties, if any, are reset. As mentioned, session-
scope checkboxes must be reset to false for any page where this property is set. This is because the
client does not submit a checkbox value when it is clear (false). If a session-scoped checkbox is not
proactively reset, it can never be set to false.
This method is not the appropriate place to initialize form value for an "update" type page (this
should be done in a setup Action). You mainly need to worry about setting checkbox values to false;
most of the time you can leave this method unimplemented.
Parameters:
mapping - The mapping used to select this instance
request - The servlet request we are processing
validate
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request)
Can be used to validate the properties that have been set for this HTTP request, and return an
ActionErrors object that encapsulates any validation errors that have been found. If no errors are
found, return null or an ActionErrors object with no recorded error messages.
The default implementation performs no validation and returns null. Subclasses must override this
method to provide any validation they wish to perform.
Parameters:
mapping - The mapping used to select this instance
request - The servlet request we are processing
Returns:
The set of validation errors, if validation failed; an empty set or null if validation succeeded.

1.1 ValidatorForm:

public class ValidatorForm extends ActionForm implements Serializable
This class extends ActionForm and provides basic field validation based on an XML file. The key
passed into the validator is the action element's 'name' attribute from the struts-config.xml which
should match the form element's name attribute in the validation.xml.
1.1.1 ValidatorActionForm:

public class ValidatorActionForm extends org.apache.struts.validator.ValidatorForm
implements Serializable
This class extends ValidatorForm and provides basic field validation based on an XML file. The key
passed into the validator is the action element's 'path' attribute from the struts-config.xml which
should match the form element's name attribute in the validation.xml.
See ValidatorPlugin definition in struts-config.xml for validation rules.
getValidationKey
public String getValidationKey(org.apache.struts.action.ActionMapping mapping,
HttpServletRequest request)
Returns the Validation key.
Overrides:
getValidationKey in class org.apache.struts.validator.ValidatorForm
Parameters:
mapping - The mapping used to select this instance
request - The servlet request we are processing
Returns:
validation key - the action element's 'path' attribute in this case
1.1.2 BeanValidatorForm:
public class BeanValidatorForm extends ValidatorForm implements DynaBean, Serializable
Struts validator ActionForm backed by either a DynaBean or POJO JavaBean.
Passing a POJO JavaBean to the constructor will automatically create an associated WrapDynaBean.
One use for this would be to migrate view objects from an existing system which, for the usual
reasons, can't be changed to extend <actionform< code="">.</actionform<>
This form is based on the standard struts ValidatorForm for use with the Validator framework and
validates either using the name from the Struts ActionMapping or the ActionMapping's path
depending on whether pathValidation is true or false.
Note: WrapDynaBean is NOT serializable. If you use this class with a WrapDynaBean (as described
above), you should not store your form in session scope.
1.2 DynaActionForm:
public class DynaActionForm extends ActionForm implements DynaBean
Specialized subclass of ActionForm that allows the creation of form beans with dynamic sets of
properties, without requiring the developer to create a Java class for each type of form bean.
USAGE NOTE - Since Struts 1.1, the reset method no longer initializes property values to those
specified in <form-property> elements in the Struts module configuration file. If you wish to utilize
that behavior, the simplest solution is to subclass DynaActionForm and call the initialize method
inside it.
1.2.1 DynaValidatorForm:
public class DynaValidatorForm extends DynaActionForm implements DynaBean, Serializable
This class extends DynaActionForm and provides basic field validation based on an XML file. The key
passed into the validator is the action element's 'name' attribute from the struts-config.xml which
should match the form element's name attribute in the validation.xml.
See ValidatorPlugin definition in struts-config.xml for validation rules.


1.2.1.1 DynaValidatorActionForm:
public class DynaValidatorActionForm extends org.apache.struts.validator.DynaValidatorForm
implements DynaBean, Serializable
This class extends DynaValidatorForm and provides basic field validation based on an XML file. The
key passed into the validator is the action element's 'path' attribute from the struts-config.xml which
should match the form element's name attribute in the validation.xml.
See ValidatorPlugin definition in struts-config.xml for validation rules.
Since:
Struts 1.1

1.3 MockFormBean:

public class MockFormBean extends ActionForm
General purpose form bean for unit tests.
java.lang.Object
o org.apache.struts.action.ActionForm (implements java.io.Serializable)
o org.apache.struts.action.DynaActionForm (implements
org.apache.commons.beanutils.DynaBean)
o org.apache.struts.validator.DynaValidatorForm (implements
org.apache.commons.beanutils.DynaBean, java.io.Serializable)
o org.apache.struts.validator.DynaValidatorActionForm (implements
org.apache.commons.beanutils.DynaBean, java.io.Serializable)
o org.apache.struts.validator.ValidatorForm (implements java.io.Serializable)
o org.apache.struts.validator.BeanValidatorForm (implements
org.apache.commons.beanutils.DynaBean, java.io.Serializable)
o org.apache.struts.validator.LazyValidatorForm
o org.apache.struts.validator.ValidatorActionForm (implements
java.io.Serializable)
o org.apache.struts.validator.FieldChecks (implements java.io.Serializable)
o org.apache.struts.validator.Resources
o org.apache.struts.validator.ValidatorPlugIn (implements org.apache.struts.action.PlugIn)

ActionForward:

public class ActionForward extends ForwardConfig
ActionForward should represent a logical outcome of an Action.An ActionForward represents a
destination to which the controller, RequestProcessor, might be directed to perform a
RequestDispatcher.forward or HttpServletResponse.sendRedirect to, as a result of processing
activities of an Action class. Instances of this class may be created dynamically as necessary, or
configured in association with an ActionMapping instance for named lookup of potentially multiple
destinations for a particular mapping instance.
An ActionForward has the following minimal set of properties. Additional properties can be provided
as needed by subclassses.
contextRelative - Should the path value be interpreted as context-relative (instead of
module-relative, if it starts with a '/' character? [false]
name - Logical name by which this instance may be looked up in relationship to a particular
ActionMapping.
path - Module-relative or context-relative URI to which control should be forwarded, or an
absolute or relative URI to which control should be redirected.
redirect - Set to true if the controller servlet should call HttpServletResponse.sendRedirect()
on the associated path; otherwise false. [false]
Since Struts 1.1 this class extends ForwardConfig and inherits the contextRelative property.
NOTE - This class would have been deprecated and replaced by
org.apache.struts.config.ForwardConfig except for the fact that it is part of the public API that
existing applications are using
ActionMapping:.
public class ActionMapping extends ActionConfig
An ActionMapping represents the information that the controller, RequestProcessor, knows about
the mapping of a particular request to an instance of a particular Action class. The ActionMapping
instance used to select a particular Action is passed on to that Action, thereby providing access to
any custom configuration information included with the ActionMapping object.
Since Struts 1.1 this class extends ActionConfig.
NOTE - This class would have been deprecated and replaced by
org.apache.struts.config.ActionConfig except for the fact that it is part of the public API that existing
applications are using.
findForward
public ActionForward findForward(String forwardName)
Find and return the ForwardConfig instance defining how forwarding to the specified logical name
should be handled. This is performed by checking local and then global configurations for the
specified forwarding configuration. If no forwarding configuration can be found, return null.
Parameters:
forwardName - Logical name of the forwarding instance to be returned
Returns:
The local or global forward with the specified name.




Action Messages:

public class ActionMessages extends Object implements Serializable
A class that encapsulates messages. Messages can be either global or they are specific to a particular
bean property.
Each individual message is described by an ActionMessage object, which contains a message key (to
be looked up in an appropriate message resources database), and up to four placeholder arguments
used for parametric substitution in the resulting message.
IMPLEMENTATION NOTE - It is assumed that these objects are created and manipulated only within
the context of a single thread. Therefore, no synchronization is required for access to internal
collections.
Since:
Struts 1.1
Action Errors:
public class ActionErrors extends ActionMessages implements java.io.Serializable
A class that encapsulates the error messages being reported by the validate() method of an
ActionForm. Validation errors are either global to the entire ActionForm bean they are associated
with, or they are specific to a particular bean property (and, therefore, a particular input field on the
corresponding form).
Each individual error is described by an ActionError object, which contains a message key (to be
looked up in an appropriate message resources database), and up to four placeholder arguments
used for parametric substitution in the resulting message.
IMPLEMENTATION NOTE - It is assumed that these objects are created and manipulated only within
the context of a single thread. Therefore, no synchronization is required for access to internal
collections.

Você também pode gostar