ActionMappingParametersInteceptor the ActionMappingParametersInteceptor interceptor is in the defaultStack 14th position. The interceptor inherits from ParametersInterceptor and is also used to set parameters to ValueStack, except that the parameters of the interceptor are from ActionMapping, not request parameters. The logic for setting values in ValueStack is exactly the same as that of ParametersInterceptor. This is the reason why the ParametersInterceptor interceptor was placed before the interceptor. You can find that the interceptor only overwrites ParametersInterceptor's two methods: [java] view plaincopy @ Override protected Map <String, Object> retrieveParameters (ActionContext ac) {// obtain the AcitonMapping object ActionMapping mapping = (ActionMapping) ac. get (ServletActionContext. ACTION_MAPPING); if (mapping! = Null) {return mapping. getParams (); // get the AcitonMapping parameter} else {return Collections. emptyMap () ;}@ Override // set the parameter to protected void addParametersToContext (ActionContext ac, Map newParams) in the parameters Map of ActionContext {// obtain the request parameter Map previousParams = ac. getParameters (); Map combinedParams = null; if (previousParams! = Null) {combinedParams = new TreeMap (previousParams);} else {combinedParams = new TreeMap ();} // newParams is the valid parameter after the validity check in ActionMapping. putAll (newParams); // set the Request parameters and valid parameters to the parameters Map of ActionContext. setParameters (combinedParams);} Because ActionMappingParametersInteceptor interceptor is currently executed, the retrieveParameters method called in the doIntercept method of ParametersInterceptor is ActionMappingParametersInteceptor interceptor. The retrieveParameters in is a manifestation of java polymorphism. Therefore, the interceptor overwrites the retrieveParameters method of the parent class to change the parameter source. The addParametersToContext method is called in the last sentence of the setParameters method of the ParametersInterceptor interceptor, And the addParametersToContext method is overwritten in the ActionMappingParametersInteceptor subclass. Therefore, the addParametersToContext method defined by the interceptor is executed, set the Request parameters and valid parameters to the parameters Map of ActionContext. However, it should be noted that the ActionMapping parameter is always null, so the operation to set the value of ValueStack when the interceptor is executed will not occur at all. The source code is used to prove this. Before proving the relationship between ActionConfig, ActionMapping, and ActionMapper, you must understand that the ActionConfig object stores the configuration information of the Action, and the ActionMapping object stores the Action ing information of the Action, actionMapper matches with ActionConfig Based on the URL you visit and maps it to an ActionMapping object. For example, a single Action configuration can contain multiple methods and multiple results, but only one method in the Action can be executed during execution, only one Result can be returned, and the ActionMapper function is to map the URL to AcitonConfig to an ActionMapping object. StrutsPrepareAndExecuteFilter doFilter method: [java] public void doFilter (ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {// omitted... actionMapping mapping = prepare. findActionMapping (request, response, true); // call the findActionMapping of the prepare object // omitted ...} the findActionMapping method is as follows: [java] public ActionMapping findActionMapping (HttpServletRequest request, HttpServl EtResponse response, boolean forceLookup) {ActionMapping mapping = (ActionMapping) request. getAttribute (STRUTS_ACTION_MAPPING_KEY); if (mapping = null | forceLookup) {try {// find the ActionMapper object in the container, and call the getMapping method of the ActionMapper object to return the ActionMapping object mapping = dispatcher. getContainer (). getInstance (ActionMapper. class ). getMapping (request, dispatcher. getConfigurationManager (); if (mapping! = Null) {request. setAttribute (STRUTS_ACTION_MAPPING_KEY, mapping) ;}} catch (Exception ex) {dispatcher. sendError (request, response, servletContext, HttpServletResponse. SC _INTERNAL_SERVER_ERROR, ex) ;}} return mapping;} ActionMapper is an interface, and its default implementation class in struts2 is org. apache. struts2.dispatcher. mapper. defaultActionMapper. The getMapping method of this class is as follows: [java] public ActionMapping getMapping (HttpServletRequest request, ConfigurationManager configManager) {ActionMapping mapping = new ActionMapping (); // create an ActionMapping object String uri = getUri (request); // obtain URI int indexOfSemicolon = uri. indexOf (";"); uri = (indexOfSemicolon>-1 )? Uri. substring (0, indexOfSemicolon): uri; // process URI uri = dropExtension (uri, mapping); // remove the URI suffix if (uri = null) {return null ;} // parse the namespace and name parseNameAndNamespace (uri, mapping, configManager) of the Action; // process special parameters handleSpecialParameters (request, mapping); if (mapping. getName () = null) {return null;} // parse ActionName, because struts2 supports dynamic method calls, such as xxxAction! Login parseActionName (mapping); return mapping;} initially thought it would set the ActionMapping parameter in handleSpecialParameters, but after reading it, I found that there was no operation to set parameters for ActionMapping, therefore, if defaactionactionmapper is used as the implementation class of ActionMapper, the parameter in ActionMapping is null. At this point, the interceptor will be mentioned here. Prepare the next Interceptor ......