使用了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
#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"
/>