欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

使用struts标签中s:property标签访问静态变量

程序员文章站 2022-07-13 11:36:18
...
1、在struts.xml配置文件中增加访问静态变量的配置
    <constant name="struts.ognl.allowStaticMethodAccess" value="true"></constant>

2、在web.xml配置文件中过滤器,使其能过滤jsp相关文件
<filter>
		<filter-name>struts2</filter-name>
		<filter-class>
            org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
        	</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>*.jsp</url-pattern>
	</filter-mapping>


3、使用s:property 访问
<s:property value="@类路径@方法名称(参数)" escape="false"/>
相关标签: struts s:property