The previous article briefly introduced Web. xml configuration.
Now let's take a look at the struts configuration.
First, copy a struts. xml file.
Before looking at the configuration, analyze the process of processing client requests on the server.
First, Tomcat receives the request and analyzes which webapplication is used.
Then go to the application to check the configuration. A filter is provided. From filter mapping, let's take a look at the filters to filter the IP addresses.
The filtered P addresses will be received and processed by the filter.
If the filter is struts2. The filter will view the namespace of the URL request.
Find the corresponding action
Display the corresponding JSP according to the action result
Processed by struts.
1> first of all, it is worth noting that if we want to make any changes to the configuration file during development, it will immediately take effect, rather than re-configuring the startup. So we need to use the configuration.
<Constant name = "struts. devmode" value = "true"/>
The namespace of the package can be empty, which indicates that actions in all paths can be processed. Namespace is blank. The default value is namespace = ""
The namespace should also be named by the module.
Generally, you must configure your own class in the action. If not configured, use the default class: actionsupport ..
<Result name = ""> if the name is not configured, the default value is success.
In the development of ER, the defined action is indeed inherited from actionsupport.
Note that struts2 processes the action as a new action object for each access.