struts2 sitemesh不起作用(问题已解决)

今天第一次搭建struts2框架,遇到的问题还真多,按照struts的方法在系统添加了对sitemesh的支持

 

登录页面sitemesh正常工作,我本以为OK了,没想到登录成功后,转到index.jsp时,sitemesh竟然不工作了,我仔细的检查了几遍,问题依旧

 

无意间在网上看到说web.xml的struts2, sitemesh配置顺序应该是这样的

 

  1. ActionCleanUp
  2. sitemesh
  3. struts2

正常的web.xml

 <!-- config ActionContextCleanUp filter -->
 <filter>
  <filter-name>struts-cleanup</filter-name>
  <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
 </filter>
 <filter-mapping>
  <filter-name>struts-cleanup</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 <!-- config 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>
 <!-- config struts2 -->
 <filter>
  <filter-name>struts2</filter-name>
  <filter-class>
   org.apache.struts2.dispatcher.FilterDispatcher
  </filter-class>
 </filter>
 <filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 <!-- config sitemesh tld -->
 <jsp-config>
  <taglib>
   <taglib-uri>sitemesh-page</taglib-uri>
   <taglib-location>
    /WEB-INF/tld/sitemesh-page.tld
   </taglib-location>
  </taglib>

  <taglib>
   <taglib-uri>sitemesh-decorator</taglib-uri>
   <taglib-location>
    /WEB-INF/tld/sitemesh-decorator.tld
   </taglib-location>
  </taglib>
 </jsp-config>  
 <!-- config welcome page -->
 <welcome-file-list>
  <welcome-file>/form/login.jsp</welcome-file>
 </welcome-file-list>

 

我原来的顺序:

  1. struts2
  2. sitemesh

看来struts2+spring2.5+hibernate3.2(增加对sitemesh, ajax的支持)的路还长着呢

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值