One.
Once the server receives the URL request, it first runs the filter in Web. XML to see what requests can be accepted.
<filter> <filter-name>Struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter</filter-class> </ filter> <filter-mapping> <filter-name>Struts2</filter-name> < url-pattern>*</url-pattern> </filter-mapping>
Like * This means that any request that is a URL input can be accepted to run, and if it is *.action, only the request with the suffix action will be processed.
Then go to the struts.xml to match if there is any configuration of this action, and if so, execute it. For example, if our request path is localhost:8080/a/b/register.action, then we will go to struts.xml see if there is no action under this path, if not, then look localhost:8080/a/ Register.action inside there is no, know not to find so far. This involves namespace issues.
The corresponding action is found and the corresponding request is processed
Two.
If there is a problem related to form submission, we usually first get the form submission page (not filter the request), if we deploy the project, we can naturally access it, and then click "Submit" when the action of the form form will be processed to see if the request satisfies the requirements of the filter, And then proceed to the "one" step
This time the URL will be accessed by the path to the URL of the filter in Web. XML to achieve a jump.
A detailed experience of struts working principle