您的位置:首页 > 编程语言 > Java开发

struts2 调用静态方法异常处理

2014-10-15 15:39 330 查看
使用了struts最新的版本struts-2.3.15.3,当我在jsp页面中使用ognl访问类的静态方法时,发现不起作用。也没报错信息,找不到原因。网上搜了一下,有一个名为struts.ognl.allowStaticMethodAccess的配置项,

#Whether to allow static method access in OGNL expressions or not

struts.ognl.allowStaticMethodAccess=false

于是把false改成true,配置到struts.properties中

struts.ognl.allowStaticMethodAccess=true

问题解决

也可以配置在struts.xml中

<constant name="struts.ognl.allowStaticMethodAccess" value="true" />
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: