0

有人可以帮我解决如何排除子窗口的装饰吗?这是我的代码:

网页.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Hello World Struts 2 Maven</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

     <listener>
        <listener-class>org.apache.struts2.dispatcher.ng.listener.StrutsListener</listener-class>
    </listener>

    <!--Filters  -->  

    <filter>
        <filter-name>struts-cleanup</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
    </filter>
    <filter>
        <filter-name>struts-prepare</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
    </filter>
    <filter>
        <filter-name>struts-execute</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
    </filter>
    <filter>
        <filter-name>sitemesh</filter-name>
        <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>struts-prepare</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>struts-execute</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>struts-cleanup</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

</web-app>

struts.xml:

<struts>

    <constant name="struts.devMode" value="true" />

    <package name="basicstruts2" extends="struts-default">

        <!-- If no class attribute is specified the framework will assume success and 
        render the result index.jsp -->
        <!-- If no name value for the result node is specified the success value is the default -->
        <action name="index">
            <result>/index.jsp</result>
        </action>
              <action name="child3">
            <result>/WEB-INF/popUp/Test.jsp</result>
        </action>

        <!-- If the URL is hello.action the call the execute method of class HelloWorldAction.
        If the result returned by the execute method is success render the HelloWorld.jsp -->
        <action name="hello" class="org.apache.struts.helloworld.action.HelloWorldAction" method="execute">
            <result name="success">/HelloWorld.jsp</result>
        </action>

    </package>

</struts>

装饰器.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<decorators defaultdir="/decorators">
    <excludes>

        <pattern>/WEB-INF/popUp/Test.jsp</pattern>
        <pattern>/popUp/Test.jsp</pattern>
        <pattern>child3.html</pattern>
        <pattern>child3</pattern>
        <pattern>/default/child3</pattern>
        <pattern>/default/child3.html</pattern>
    </excludes> 
    <decorator name="main" page="layout.jsp">
        <pattern>/*</pattern>
    </decorator>
    <decorator name="panel" page="panel.jsp" />
</decorators>

我已经在这个任务上花了 2 天时间,但还没有成功。任何人都可以帮助或指向我的一些链接吗?

问候, 纳齐尔

4

1 回答 1

0

我解决了这个问题。我添加了 struts2-sitemesh 插件并按照配置 web xml 的文档进行操作。现在我的装饰器工作得很好。

于 2012-05-13T17:43:18.910 回答