web.xml配置没问题:按照
定义ActionContextCleanUp过滤器
定义SiteMesh的核心过滤器
定义Struts 2的核心过滤器
的顺序定义的,与struts2整合的jar包和sitemesh的包也导入过了,
web-inf/decorators.xml文件配置如下:<?xml version="1.0" encoding="GBK"?>
<decorators defaultdir="/decorators">
<decorator name="main" page="main.jsp">
<pattern>/view/*</pattern>
</decorator>
</decorators>view为webRoot下一个文件夹为何此时在view文件夹下的的jsp文件得不到装饰啊,若改为<pattern>/*<pattern>就行了!

解决方案 »

  1.   

    sitemesh的装饰是和浏览器地址栏里的url匹配的。
    你看一下访问这些页面的时候,显示的路径是Action的路径吧。
      

  2.   

    sitemesh 不支持<pattern>/view/*</pattern>这种形式要么直接用/*要么直接指定到页面。所以这点真的做的很差。
      

  3.   

    各位,我把路径写作如下<partter>/view/main.jsp</parttern>
    报错:异常
    com.opensymphony.module.sitemesh.factory.FactoryException: Cannot construct Factory : com.opensymphony.module.sitemesh.factory.DefaultFactory: com.opensymphony.module.sitemesh.factory.FactoryException: Root element of sitemesh configuration file not <sitemesh>: null
    com.opensymphony.module.sitemesh.Factory.getInstance(Factory.java:50)
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.initContentProcessor(SiteMeshFilter.java:107)
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:54)
    org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)这又是什么问题哦?