struts2 no longer accepts http map parameters?

后端 未结 1 469
挽巷
挽巷 2021-01-13 09:39

In struts2, I took advantage of built-in OGNL in struts2, naming my inputs like Which went to getters/setters

相关标签:
1条回答
  • 2021-01-13 10:23

    It turns out that they hardened restrictions on parameter names to boost security.

    So I had to add to my struts.xml:

           <interceptor-stack name="defaultStack">
              <interceptor-ref name="params">
                 <!-- For maps to work -->
                 <param name="acceptParamNames">
                     [a-zA-Z0-9\.\]\[\(\)_'\s"/]+
                 </param>
              </interceptor-ref>
           </interceptor-stack>
    

    (I had "s and /s in my parameter names) File upload ceased working after that (interceptor stacks are madness), so I had to add it explicity either.

    Update: These days I strongly suggest using JSON to pass complex structures instead of rich OGNL forms. Of course you would need some JS.

    0 讨论(0)
提交回复
热议问题