Posted on 2010-11-03 15:52
asdtiang 阅读(1233)
评论(0) 编辑 收藏 所属分类:
java ee
主要参考这个文档:http://struts.apache.org/2.2.1/docs/sitemesh-plugin.html
我的项目是struts2.1.8的,郁闷的很,在装饰页面不能使用struts的标签。
看了网上没找到好的解决办法,就是官网上去,首先升级struts到2.2.1,然后参照文档就可以了:
<filter>
<filter-name>struts-prepare</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
</filter>
<filter>
<filter-name>struts-execute</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
</filter>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-prepare</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts-execute</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
再刷新下页面,出来了
天苍苍,野茫茫,风吹草底见牛羊