Struts2 Sitemesh无法在WAS 6服务器上运行

时间:2009-07-23 05:00:18

标签: struts2 decorator sitemesh

我有一个struts2-spring应用程序,可以在jetty服务器上正常工作但是当我尝试将它迁移到WAS 6时,装饰器(sitemesh)没有得到应用。服务器日志显示没有错误。这是一个已知问题吗? 我的web.xml看起来像这样

<filter>
    <filter-name>action2-cleanup</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter>
    <filter-name>sitemesh</filter-name>
    <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>
<filter>
    <filter-name>action2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
    <filter-name>action2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>action2-cleanup</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>REQUEST</dispatcher>
</filter-mapping>

1 个答案:

答案 0 :(得分:0)

问题是url-pattern,websphere内部使用<url-pattern>/*</url-pattern>来解决某些问题,解决方案是将其更改为新的内容:

<filter>
    <filter-name>action2-cleanup</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter>
    <filter-name>sitemesh</filter-name>
    <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>
<filter>
    <filter-name>action2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
        <filter-name>action2</filter-name>
        <url-pattern>/app</url-pattern>
</filter-mapping>
<filter-mapping>
        <filter-name>action2-cleanup</filter-name>
        <url-pattern>/app</url-pattern>
</filter-mapping>
<filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/app</url-pattern>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
        <dispatcher>REQUEST</dispatcher>
</filter-mapping>

并将应用程序文件放在该路径下