Parameters with no mutators and accessors (setters/getters) along with the parameters interceptor in Struts 2

前端 未结 3 1740
故里飘歌
故里飘歌 2020-12-19 06:31

In the following action class, I\'m using the parameters interceptor.

@Namespace(\"/admin_side\")
@ResultPath(\"/WEB-INF/content\")
@ParentPackage(value = \"         


        
3条回答
  •  Happy的楠姐
    2020-12-19 06:51

    Lets take a look at the paramsPrepareParamsStack:

     
          
          
          
          
          
          
              dojo\..*,^struts\..*
          
          
          
          
          
          
          
          
          
              dojo\..*,^struts\..*
           
           
           
               input,back,cancel,browse
           
           
               input,back,cancel,browse
           
     
    

    There are 2 params interceptors. When you are setting excludeParams parameter in your action class, then this is probably set for the first params interceptor - parameter for the second interceptor stays default. Now, when the second params interceptor (with default excludeParams) is invoked, then given exception is thrown.

    You can try to duplicate setting of the excludeParams parameter to set its also for the second interceptor:

     @InterceptorRef(value = "paramsPrepareParamsStack", params = {"params.acceptParamNames", "param1, param2", "params.excludeParams", "extraParam", "params.excludeParams", "extraParam", "validation.validateAnnotatedMethodOnly", "true", "validation.excludeMethods", "load"})})
    

提交回复
热议问题