请教:sitemesh如何装饰Struts 2中的action的问题
本人现在程序中存在的问题:
使用sitemesh进行装饰所有页面,但是当请求是Struts的action(例如*.do,*.action)时,就不能装饰.
注:现在所有的.jsp 和.action都在应用根目录下.
配置文件如下:
decorators.xml
<decorators defaultdir="/"> <decorator name="frame" page="template.jsp"> <pattern>/*</pattern> </decorator></decorators>
<!-- SiteMesh --> <filter> <filter-name>sitemesh</filter-name> <filter-class> com.opensymphony.module.sitemesh.filter.PageFilter </filter-class> </filter> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <jsp-config> <taglib> <taglib-uri>sitemesh-page</taglib-uri> <taglib-location> /WEB-INF/sitemesh-page.tld </taglib-location> </taglib> <taglib> <taglib-uri>sitemesh-decorator</taglib-uri> <taglib-location> /WEB-INF/sitemesh-decorator.tld </taglib-location> </taglib> </jsp-config>
<action name="car" class="struts.action.Car_jsp_Action"> <result name="success">car.jsp</result> <result name="input">car.jsp</result> </action>
<filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>*.jsp</url-pattern> <dispatcher>FORWARD</dispatcher> <dispatcher>REQUEST</dispatcher> </filter-mapping>