在struts2中我知道我们可以通过OGNL调用静态方法。从下午开始我一直在尝试调用这个静态方法,但似乎无法找出问题所在。
struts.xml配置:
<constant name="struts.ognl.allowStaticMethodAccess" value="true" />
jsp页面:
.....<s:property value='@com.aesthete.csmart.web.server.fw.common.config.Properties@getDefaultProperty("maxdemocountwords")'/>....
属性.java
public static String getDefaultProperty(String key){
return defaultProps.getProperty(key);
}
我有什么遗漏吗?
最佳答案
您是否检查过 struts.properties
中的 struts.ognl.allowStaticMethodAccess
属性是否设置为 true
?
关于java - struts2静态方法调用问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8344820/