我正在尝试将 sitemesh2.4 用于我的基于 GAE(struts 1.3,spring 2.5)的应用程序。我找到了一些配置 sitemesh 的教程。我也做了同样的事情。
web.xml
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
装饰器.xml
<decorators defaultdir="/decorators/">
<excludes>
<pattern>/**.xml</pattern>
</excludes>
<decorator name="base" page="base.jsp">
<pattern>/*</pattern>
</decorator>
</decorators>
在此之后,我创建了一个 dir 装饰器,并在该 base.jsp 中作为装饰器。但是当我访问 localhost:8088/时,装饰器没有应用。我正在使用 intellij idea 并附加了 sitemesh 的源代码进行调试。当我启动服务器时,会调用 SitemeshFilter 的 'init' 方法,但是当我访问 url 时,甚至不会调用 'doFilter' 方法。
需要这方面的帮助。谢谢
最佳答案
我找到了问题的解决方案。实际上我也在使用 urlrewriter 过滤器。在我的 web.xml 中,我在 sitemesh 上方有这个过滤器,这就是问题所在。我将 sitemesh 过滤器移到了上面,现在它工作正常。
关于java - Sitemesh 2.4 与 GAE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7213339/