我有一个spring tiles配置文件,其中包含以下代码行。任何人都可以帮助我理解这些界限。另请指导我如何获得此路径(" / WEB-INF / jsp / contents / {1} .jsp")
<definition name="template-main" template="/WEB-INF/jsp/layouts/main.jsp">
<put-attribute name="header-content" value="/WEB-INF/jsp/sections/header.jsp" />
<put-attribute name="banner-content" value="/WEB-INF/jsp/sections/banner.jsp" />
<put-attribute name="footer-content" value="/WEB-INF/jsp/sections/footer.jsp" />
</definition>
<!-- anything that doesn't start with a slash is considered a definition here. -->
<definition name="*" extends="template-main">
<put-attribute name="primary-content" value="/WEB-INF/jsp/contents/{1}.jsp" />
</definition>
答案 0 :(得分:2)
它只是通配符支持
https://tiles.apache.org/framework/tutorial/advanced/wildcard.html
而不是为每个页面定义多个定义
<definition name="AAA" extends="template-main">
<put-attribute name="primary-content" value="/WEB-INF/jsp/contents/AAA.jsp" />
</definition>
<definition name="BBB" extends="template-main">
<put-attribute name="primary-content" value="/WEB-INF/jsp/contents/BBB.jsp" />
</definition>
<definition name="CCC" extends="template-main">
<put-attribute name="primary-content" value="/WEB-INF/jsp/contents/CCC.jsp" />
</definition>
定义了基于通配符的定义。
所以,如果你要求&#34; AAA&#34; tile被替换并且返回了AAA.jsp