---
title: "Struts2标签中访问静态变量或者方法"
author: "harbey"
date: "2009-07-28T10:40:42Z"
tags: []
slug: "struts2"
draft: false
lastmod: "2009-07-28T10:40:42Z"
id: 434281
url: "https://harbey.iteye.com/blog/434281"
---

```java

 http://wmj2003.iteye.com/blog/379448

```

Struts2标签中访问静态变量或者方法 
在2.1.2中，如果要通过ognl访问静态方法，必须在struts.properties或者struts.xml中将选项struts.ognl.allowStaticMethodAccess设置为true.


<s:propteryvalue="@com.work.core.QxglConstants@TOP_LEVEL_TOP"/>

<s:iftest="#session.deptid==@com.work.core.QxglConstants@TOP_LEVEL_DEPT_ID">复检受理</s:if>


注意：访问的类名必须是全称。是@com.work.core.QxglConstants而不是@QxglConstants

<!--EndFragment-->