如何修改struts-dojo and/or struts-jquery (Struts 2.3.20.1)中的路径?

How to modify the paths in struts-dojo and/or struts-jquery (Struts 2.3.20.1)?

这里是我开始解决问题之前的开发设置:

现在我的问题是:

我想在 Struts2-Dojo 或 *-JQuery 中使用 DateTimePicker,但是对于这两个 API 我在生成的 HTML 端得到错误的路径.

看看这些图片,我的结果是什么:

Struts 2 - DOJO(第一个浏览器视图,第二个 HTML src)

Struts 2 - JQuery(第一个浏览器视图,第二个 HTML src)

你看到我的问题了吗?双破折号?为什么 Struts 那?这是 Tiles 的问题吗?

我只需要一个破折号,我之前在这个 link 上查找过这个社区: Relative Path in Struts 2 - DOJO

... 并对此进行测试(您可以在下面的 BaseLayout.jsp 下看到它)它对我的问题不起作用。

这是我的 web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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"
         version="2.4">
    <display-name>Struts Tiles 2 Demo</display-name>
    <context-param>
        <param-name>tilesDefinitions</param-name>
        <param-value>/WEB-INF/tiles.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
    </listener>

    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

struts.xml:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
        "http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>
    <constant name="struts.enable.DynamicMethodInvocation" value="false"/>
    <constant name="struts.devMode" value="false"/>

    <!--suppress InjectedReferences -->
    <package name="default" extends="struts-default" namespace="/">
        <result-types>
            <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/>
        </result-types>

        <default-action-ref name="start"/>

        <action name="start">
            <result name="success" type="tiles">index</result>
            <result name="error" type="tiles">err404</result>
        </action>

        <action name="err404">
            <result name="success" type="tiles">err404</result>
        </action>

        <action name="dbTest">
            <result name="success" type="tiles">dbTest</result>
            <result name="error" type="tiles">err404</result>
        </action>

        <action name="dtpJQ">
            <result name="success" type="tiles">dtpJQ</result>
            <result name="error" type="tiles">err404</result>
        </action>
    </package>
</struts>

tiles.xml:

<!DOCTYPE tiles-definitions PUBLIC
        "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
        "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">

<tiles-definitions>

    <definition name="baseLayout" template="/WEB-INF/tiles/layouts/BaseLayout.jsp">
        <put-attribute name="title" value="" />

        <put-attribute name="header" value="/WEB-INF/tiles/parts/Header.jsp" />
        <put-attribute name="menu" value="/WEB-INF/tiles/parts/Menu.jsp" />

        <put-attribute name="body" value="" />
        <put-attribute name="footer" value="/WEB-INF/tiles/parts/Footer.jsp" />

        <!-- only true or false -->
        <put-attribute name="isDojoActive" value="false" />
        <put-attribute name="isJQueryActive" value="false" />
    </definition>

    <definition name="index" extends="baseLayout">
        <put-attribute name="title" value=".: 1st Steps Base Layout Struts 2 :." />
        <put-attribute name="body" value="/WEB-INF/tiles/body/start.jsp" />
    </definition>

    <definition name="err404" extends="baseLayout">
        <put-attribute name="title" value=".: Test Error 404 Page :." />
        <put-attribute name="body" value="/WEB-INF/tiles/errorPages/404.jsp" />
    </definition>

    <definition name="dbTest" extends="baseLayout">
        <put-attribute name="title" value=".: DB Test :." />
        <put-attribute name="body" value="/WEB-INF/tiles/tableViews/dbTest.jsp" />
    </definition>

    <definition name="dtpTest" extends="baseLayout">
        <put-attribute name="title" value=".: Date Time Picker Test - START :." />
        <put-attribute name="body" value="/WEB-INF/tiles/body/testDTP.jsp" />
        <put-attribute name="isDojoActive" value="true" />
    </definition>

    <definition name="dtpJQ" extends="baseLayout">
        <put-attribute name="title" value=".: DTP JQ TEST :." />
        <put-attribute name="body" value="/WEB-INF/tiles/modules/dateTimePickerJQuery.jsp" />
        <put-attribute name="isJQueryActive" value="true" />
    </definition>

    <definition name="dateTimePicker" extends="baseLayout">
        <put-attribute name="title" value=".: Date Time Picker Test :." />
        <put-attribute name="body" value="/WEB-INF/tiles/modules/dateTimePicker.jsp" />
    </definition>
</tiles-definitions>

BaseLayout.jsp:

<%@page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="tiles"  uri="http://tiles.apache.org/tags-tiles" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<%@taglib prefix="sx" uri="/struts-dojo-tags" %>
<%@taglib prefix="sj" uri="/struts-jquery-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title><tiles:insertAttribute name="title" ignore="true" /></title>
    <style type="text/css">@import url(/css/main.css);</style>
    <s:set var="isDojoActive"><tiles:getAsString name="isDojoActive" /></s:set>
    <s:set var="isJQueryActive"><tiles:getAsString name="isJQueryActive" /></s:set>
    <s:if test='%{#isDojoActive.equals("true")}'>
        <sx:head baseRelativePath="/struts/dojo" debug="true" parseContent="false" />
    </s:if>
    <s:if test='%{#isJQueryActive.equals("true")}'>
        <sj:head />
    </s:if>
</head>
<body>
<div class="container">
    <div id="baseLeft"><tiles:insertAttribute name="menu" /></div>
    <div id="baseRight">
        <div class="inner-content header center"><tiles:insertAttribute name="header" /></div>
        <div class="inner-content body"><tiles:insertAttribute name="body" /></div>
        <div class="inner-content footer right"><tiles:insertAttribute name="footer" /></div>
    </div>
</div>
</body>
</html>

我发现了错误:

我在 IntelliJ IDEA 下的 TomEE 配置:

缺少root/application上下文