有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java struts2静态方法调用问题

在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")'/>....

财产。爪哇

public static String getDefaultProperty(String key){
        return defaultProps.getProperty(key);
}

我有什么遗漏吗


共 (1) 个答案

  1. # 1 楼答案

    您是否检查了struts.properties中的struts.ognl.allowStaticMethodAccess属性是否设置为true