Struts 2 : Passing array of String as static param

前端 未结 5 477
生来不讨喜
生来不讨喜 2020-12-21 07:11

I wanted to declare an action in such a way that I could pass String array of static parameter. I tried the below code:



        
5条回答
  •  抹茶落季
    2020-12-21 07:23

    The static parameters processed by the staticParams interceptor via the action config where the parameters are defined as Map.

    For proper use of static parameters in the action config you should include reference to the interceptor staticParams or use the defaultStack.

    
          true
          false    
    
    

    You have also include setParams(Map params) in the action to the interceptor set the values of the params. Use different keys name1, name2, name3 in your case to retrieve the values of the map. You can also try overwrite property (not documented) for the static params to not overwrite the value with the same key.

    You can see the example of using static parameters in action config: Configure static parameter for Action class

提交回复
热议问题