ActionServlet provides the "controller" in the Model-View-Controller (MVC) design pattern for web applications that is commonly known as "Model 2". This nomenclature originated with a description in the JavaServerPages Specification, version 0.92, and has persisted ever since (in the absence of a better name).
Generally, a "Model 2" application is architected as follows:
RequestProcessor selects and invokes an Action class to perform
the requested business logic, or delegates the response to another resource.Action classes can manipulate the state of the application's
interaction with the user, typically by creating or modifying JavaBeans
that are stored as request or session attributes (depending on how long
they need to be available). Such JavaBeans represent the "model"
component of an MVC architecture.Action classes generally return an ActionForward to indicate
which resource should handle the response. If the Action
does not return null, the RequestProcessor forwards or
redirects to the specified resource (by utilizing
RequestDispatcher.forward or Response.sendRedirect)
so as to produce the next page of the user interface.The standard version of RequestsProcessor implements the
following logic for each incoming HTTP request. You can override
some or all of this functionality by subclassing this object and
implementing your own version of the processing.
Action interface).
Action class,
instantiate an instance of that class and cache it for future use.ActionForm bean
associated with this mapping.execute method of this Action class, passing
on a reference to the mapping that was used, the relevant form-bean
(if any), and the request and the response that were passed to the
controller by the servlet container (thereby providing access to any
specialized properties of the mapping itself as well as to the
ServletContext).
The standard version of ActionServlet is configured based
on the following servlet initialization parameters, which you will specify
in the web application deployment descriptor (/WEB-INF/web.xml)
for your application. Subclasses that specialize this servlet are free to
define additional initialization parameters.
ModuleConfigFactory used to create the implementation of the
ModuleConfig interface.
[org.apache.struts.config.impl.DefaultModuleConfigFactory]
java.lang.Integer) will default to null (rather than 0).
(Since Struts 1.1) [false] org.apache.commons.digester.RuleSet
instances that should be added to the Digester that will
be processing struts-config.xml files. By default, only
the RuleSet for the standard configuration elements is
loaded. (Since Struts 1.1)| Field Summary | |
|---|---|
| protected String |
Comma-separated list of context-relative path(s) to our configuration resource(s) for the default module. |
| protected Digester |
The Digester used to produce ModuleConfig objects from a Struts configuration file. |
| protected boolean |
The flag to request backwards-compatible conversions for form bean properties of the Java wrapper class types. |
| protected FastHashMap |
The JDBC data sources that has been configured for this module, if any, keyed by the servlet context attribute under which they are stored. |
| protected MessageResources |
The resources object for our internal resources. |
| protected String |
The Java base name of our internal resources. |
| protected static Log |
Commons Logging instance. |
| protected RequestProcessor |
The |
| protected String[] |
The set of public identifiers, and corresponding resource names, for the versions of the configuration file DTDs that we know about. |
| protected String |
The URL pattern to which we are mapped in our web application deployment descriptor. |
| protected String |
The servlet name under which we are registered in our web application deployment descriptor. |
| Constructor Summary |
|---|
|
No description provided. |
| Method Summary | |
|---|---|
| void |
Remember a servlet mapping from our web application deployment descriptor, if it is for this servlet. |
| void |
Gracefully shut down this controller servlet, releasing any resources that were allocated at initialization. |
| protected void |
Gracefully release any configDigester instance that we have created. |
| protected void |
Gracefully terminate use of the internal MessageResources. |
| protected void |
Gracefully terminate use of any modules associated with this application (if any). |
| void |
Process an HTTP "GET" request. |
| void |
Process an HTTP "POST" request. |
| MessageResources |
Return the |
| protected ModuleConfig |
Return the module configuration object for the currently selected module. |
| protected RequestProcessor |
Look up and return the RequestProcessor responsible for the specified module, creating a new one if necessary. |
| void |
Initialize this servlet. |
| protected Digester |
Create (if needed) and return a new |
| protected void |
Initialize our internal MessageResources bundle. |
| protected ModuleConfig |
Initialize the module configuration information for the specified module. |
| protected void |
Initialize the factory used to create the module configuration. |
| protected void |
Initialize the data sources for the specified module. |
| protected void |
Initialize the application |
| protected void |
Initialize the plug ins for the specified module. |
| protected void |
Saves a String[] of module prefixes in the ServletContext under Globals.MODULE_PREFIXES_KEY. |
| protected void |
Initialize other global characteristics of the controller servlet. |
| protected void |
Initialize the servlet mapping under which our controller servlet is being accessed. |
| protected void |
Parses one module config file. |
| protected void |
Perform the standard request processing for this request, and create the corresponding response. |
| Methods inherited from javax.servletGenericServlet |
|---|
| Methods inherited from java.langObject |
|---|
| Methods inherited from javax.servletServlet |
|---|
| Methods inherited from javax.servletServletConfig |
|---|
The Digester used to produce ModuleConfig objects from a Struts configuration file.
protected
boolean
convertNull
The flag to request backwards-compatible conversions for form bean properties of the Java wrapper class types.
The JDBC data sources that has been configured for this module, if any, keyed by the servlet context attribute under which they are stored.
The resources object for our internal resources.
The Java base name of our internal resources.
Commons Logging instance.
The RequestProcessor instance we will use to process
all incoming requests.
The set of public identifiers, and corresponding resource names, for the versions of the configuration file DTDs that we know about. There MUST be an even number of Strings in this list!
The URL pattern to which we are mapped in our web application deployment descriptor.
The servlet name under which we are registered in our web application deployment descriptor.
Remember a servlet mapping from our web application deployment descriptor, if it is for this servlet.
public
void
destroy
(
)
Gracefully shut down this controller servlet, releasing any resources that were allocated at initialization.
protected
void
destroyConfigDigester
(
)
Gracefully release any configDigester instance that we have created.
protected
void
destroyInternal
(
)
Gracefully terminate use of the internal MessageResources.
protected
void
destroyModules
(
)
Gracefully terminate use of any modules associated with this application (if any).
Process an HTTP "GET" request.
Process an HTTP "POST" request.
Return the MessageResources instance containing our
internal message strings.
Return the module configuration object for the currently selected module.
Look up and return the RequestProcessor responsible for the specified module, creating a new one if necessary.
Initialize this servlet. Most of the processing has been factored into support methods so that you can override particular functionality at a fairly granular level.
Create (if needed) and return a new Digester
instance that has been initialized to process Struts module
configuration files and configure a corresponding ModuleConfig
object (which must be pushed on to the evaluation stack before parsing
begins).
Initialize our internal MessageResources bundle.
Initialize the module configuration information for the specified module.
protected
void
initModuleConfigFactory
(
)
Initialize the factory used to create the module configuration.
Initialize the data sources for the specified module.
Initialize the application MessageResources for the specified
module.
Initialize the plug ins for the specified module.
Saves a String[] of module prefixes in the ServletContext under Globals.MODULE_PREFIXES_KEY. NOTE - the "" prefix for the default module is not included in this list.
Initialize other global characteristics of the controller servlet.
Initialize the servlet mapping under which our controller servlet
is being accessed. This will be used in the &html:form>
tag to generate correct destination URLs for form submissions.
Parses one module config file.
Perform the standard request processing for this request, and create the corresponding response.
Comma-separated list of context-relative path(s) to our configuration resource(s) for the default module.