修复漏洞,升级Struts2版本到2.3.32

              由于Struts2旧版本的安全漏洞问题,需要从旧版本2.3.15.1升级到2.3.28.1,碰到了一些问题,分享一下解决办法。

            1.一开始只替换struts2-core-2.3.28.1这个Jar包,不出意外的404了,经过比对,必须替换的包有

struts2-core-2.3.28.1 struts2-json-plugin-2.3.28.1 xwork-core-2.3.28.1

可能需要替换的包有

commons-fileupload-1.3.1 commons-io-2.2 commons-lang3-3.2 ognl-3.0.14 freemarker-2.3.22

2.更新完Jar包重启服务器不会报404错误了,但是jsp页面取不到数据,查看log是取不到js中的动态方法,例如action!function这种

所以需要在Struts.xml中添加

<constant name="struts.enable.DynamicMethodInvocation" value="true" /> 

猜你喜欢

转载自k0521klb.iteye.com/blog/2361350