Upgrading to struts 2.3.15.1 does not set HashMap values on action class

后端 未结 2 1309
旧巷少年郎
旧巷少年郎 2021-01-14 15:55

I upgraded from 2.1.6 to 2.3.15.1 because of the security fixes available in the latest version. However, now the form field values are not posted to the Action class. Basi

2条回答
  •  遥遥无期
    2021-01-14 16:29

    Solved it. With the new Struts versions parameter names are more restrictive. In my case, I had parameter names such as props['1.2.3'], props['a.b.c'] or props['a-b-c']. These were filtered out by the new struts. Here is the link which explains this: http://struts.apache.org/development/2.x/docs/s2-009.html. The very last part explains why the collections might stop working.

    I changed the acceptParamNames in the interceptor stack to \w+((\.\w+)|(\[\d+\])|(\['\w+(\-\w+)*'\]))* and it solved the issue. I got rid of the props['a.b.c'] property names so the above regex does not cover it, but it does cover props['a-b-c'].

    Thanks to @Roman C for coming forward to help me.

提交回复
热议问题