struts2 2.3.20 ognl allowStaticMethodAccess [英] struts2 2.3.20 ognl allowStaticMethodAccess

查看:36
本文介绍了struts2 2.3.20 ognl allowStaticMethodAccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的项目更新到 Struts2 版本 2.3.20 .现在我的 JSP 中使用静态方法访问的所有情况都不起作用.

I updated my project to Struts2 version 2.3.20 . Now all cases in my JSPs that uses static method access do not work.

即.

<s:set var="linkEscaped"
 value="@org.apache.commons.lang.StringEscapeUtils@escapeHtml(#attr.myObject.link)" />

我已经在我的 struts.properties 中设置了 ->

I already have set in my struts.properties ->

struts.ognl.allowStaticMethodAccess=true

并在 struts.xml 中尝试 ->

and tried in struts.xml ->

<constant name="struts.ognl.allowStaticMethodAccess" value="true"/>

没有成功.有谁知道发生了什么变化,我需要做什么才能再次启用它们?

with no success. Does anyone know what has changed and what do I need to do to enable them again?

推荐答案

由于静态方法将无法在以后的版本中使用,我决定重构项目中使用它们的部分.越早越好.

Since static methods will not be able to be used in future releases, I decided to refactor the parts of the project that use them. The sooner the better.

所以在BaseAction"中,我创建了我需要的方法,它们调用这些方法.这样只有我允许的安全"方法才能在jsp中使用.

So in y "BaseAction" I have created the methods I need and they call those methods. This way only the "safe" methods I allow can be used in the jsp.

这篇关于struts2 2.3.20 ognl allowStaticMethodAccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆