Advanced Wildcard Mappings Parameters not found in Prepare() method

前端 未结 2 1108

From the documentation: Struts2\'s Advanced Wildcard Mappings:

Advanced Wildcards

From 2.1.9+ regular expressions can be

2条回答
  •  情话喂你
    2020-11-29 12:37

    That parameters are not set by the ParametersInterceptor (like those coming from the JSP), but by the StaticParametersInterceptor.
    To have them filled in the prepare() method, the same trick of the paramsPrepareParamsStack must be applied.
    Since there is not an Interceptor Stack that does that out-of-the-box, you must define it.
    Starting from the defaultStack, we should create a Stack like this:

    
        
        
        
        
          
        
        
        
            dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...*
        
     
        
        
        
        
        
        
        
        
        
        
            dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...*
        
        
        
            input,back,cancel,browse
        
        
            input,back,cancel,browse
        
        
    
    

    Note: ActionMappingParams is not needed, just included for future uses.

    Please comment in case you discover any problem related to this. AFAIK, it works flawlessly.

提交回复
热议问题