Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Struts2 Tiles 3覆盖嵌套属性_Struts2_Tiles_Apache Tiles - Fatal编程技术网

Struts2 Tiles 3覆盖嵌套属性

Struts2 Tiles 3覆盖嵌套属性,struts2,tiles,apache-tiles,Struts2,Tiles,Apache Tiles,我对带Struts2的Tiles 3有问题。我似乎无法覆盖嵌套平铺定义的属性 以下是my web.xml的相关部分: <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter&g

我对带Struts2的Tiles 3有问题。我似乎无法覆盖嵌套平铺定义的属性

以下是my web.xml的相关部分:

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
    <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>

支柱2
org.apache.struts2.dispatcher.filter.strutspreadexecutefilter
支柱2
/*
org.apache.struts2.tiles.StrutsTilesListener
这是我的struts.xml

    <package name="helloworld" extends="tiles-default" namespace="/secure">
    <result-types>
        <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" default="true" />
    </result-types>

    <interceptors>
        <interceptor name="s2sLogging"  class="com.s2s.web.s2.S2Interceptor" />
        <interceptor-stack name="s2sStack">
            <interceptor-ref name="timer" />
            <interceptor-ref name="defaultStack" />
            <interceptor-ref name="s2sLogging" />
        </interceptor-stack>
    </interceptors>
    <default-interceptor-ref name="s2sStack" />

    <action name="howitworks"    class="com.s2s.web.s2.S2RootAction" >
        <result name="success" type="tiles">.howItWorks.landing</result>
    </action>

,我应该能够像上面一样使用子定义进行嵌套,然后扩展和覆盖属性。级联应该传播属性

不用说,我不能让它工作。有人能发现我的缺点吗


根据要求,这里是我的JSP。谢谢你的关注

所有JSP的顶部都有以下内容:

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>

这是我的page.jsp(去掉css):


- 
以下是may pageContent.jsp(去掉css):


下面是我的howitworks.jsp(同样,去掉了css)。这应该覆盖mainBodyContent属性,但我无法让它工作:

<table >
        <tr>
            <td  />Test... how it works</td>
            <td /></td>
            <td  /></td>
        </tr>
</table>

测试。。。工作原理

不清楚哪个页面不起作用。你能添加你的jsp-s吗@AleksandrM添加了我的jsp。谢谢查看。您的页面中没有
RightNavCTA
。到底是什么不起作用?@AleksandrM在
如何工作中使用
右侧导航CTA
主体内容
。登录定义不会覆盖
页面。布局
。(很抱歉延迟回复…我出差的任务金额相当,出差时禁止使用笔记本电脑)。另外,
rightNavCTAs
属性位于
righNav.jsp
中——一旦我可以访问它,我将发布这篇文章。
<tiles:importAttribute scope="request"/>
<html>

    <head>
        <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/stylesheet.css"  />
        <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/jmesa.css">
        <title>
            <tiles:getAsString name="pageTitlePrefix" /> - <tiles:getAsString name="pageTitle" />
        </title>
        <tiles:insertAttribute name="headContent" />
        <tiles:insertAttribute name="extraHeadContent" />
    </head>
    <body>
        <div id="page"> 
            <tiles:insertAttribute name="topNav" />
            <tiles:insertAttribute name="topNavSubNav" />
            <tiles:insertAttribute name="pageContent" />
            <tiles:insertAttribute name="footer" />
        </div>
    </body>
</html>
    <table >
    <tr>
        <td >
            <!-- Box Table Starts here-->
            <s:if test="%{#attr['box'] == 'true'}">
                <table >
                    <tr>
                        <td  /></td>
                        <td /></td>
                        <td  /></td>
                    </tr>
                    <tr>
                        <td >&nbsp;</td>
                        <td >
                            <!-- Insert Main Body Content1 -->
                            <tiles:insertAttribute name="mainBodyContent"  />
                            <!-- End of Main Body Content1 -->
                        </td>
                        <td >&nbsp;</td>
                    </tr>
                    <tr>
                        <td  /></td>
                        <td >&nbsp;</td>
                        <td /></td>
                    </tr>
                </table>
            </s:if>
            <s:else>
                <!-- Insert Main Body Content -->
                <tiles:insertAttribute name="mainBodyContent" />
                <!-- End of Main Body Content -->
            </s:else>
        </td>
        <td >&nbsp;</td>
        <td >
            <tiles:insertAttribute name="rightNav" />
        </td>
    </tr>
</table>
<!-- End Page Content -->
<table >
        <tr>
            <td  />Test... how it works</td>
            <td /></td>
            <td  /></td>
        </tr>
</table>