apache tiles put-list-attribute XML错误

duc*_*cin 1 attributes tiles list java-ee

我在tiles.xml中有这样的定义:

<definition name="t.base" template="/WEB-INF/tiles/base.jsp">
    <put-attribute name="title" value="SomeTitle" />
    <put-attribute name="menu" value="/WEB-INF/tiles/menu.jsp" />
    <put-attribute name="scripts" value="/WEB-INF/tiles/scripts.jsp" />
</definition>

<definition name="t.homepage" extends="t.base" preparer="com.blogspot.symfonyworld.lyricsbase.controller.TestViewPreparer">
    <put-list-attribute name="body">
        <add-attribute value="/WEB-INF/jsp/homepage.jsp" />
        <add-attribute value="/WEB-INF/tiles/footer.jsp" />
    </put-list-attribute>
    <put-attribute name="title" value="lyricsBase : home of lyrics" />
    <put-attribute name="view" value="homepage" cascade="true" />
</definition>
Run Code Online (Sandbox Code Playgroud)

在为主页处理请求时,编译器会抛出异常:

org.xml.sax.SAXParseException; lineNumber: 29; columnNumber: 18; The content of element type "definition" must match "(put-attribute*,put-list-attribute*)".
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
Run Code Online (Sandbox Code Playgroud)

我不知道出了什么问题 - 根据tiles文档,XML语法似乎是正确的.

Han*_*nno 6

<put-list-attribute>元件必须在定义的结尾,如下所示:

<definition name="t.homepage" extends="t.base" preparer="com.blogspot.symfonyworld.lyricsbase.controller.TestViewPreparer">
    <put-attribute name="title" value="lyricsBase : home of lyrics" />
    <put-attribute name="view" value="homepage" cascade="true" />
    <put-list-attribute name="body">
        <add-attribute value="/WEB-INF/jsp/homepage.jsp" />
        <add-attribute value="/WEB-INF/tiles/footer.jsp" />
    </put-list-attribute>
</definition>
Run Code Online (Sandbox Code Playgroud)