Umstellung auf Thymeleaf: Schritt 2 - Tilesunterstützung aktiviert
[website] / src / main / resources / spring / tiles.xml
index 120e604..d9dd9a6 100644 (file)
@@ -1,9 +1,26 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE tiles-definitions PUBLIC
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE tiles-definitions PUBLIC
-       "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
-       "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
+       "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
+       "http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
 <tiles-definitions>
 
 <tiles-definitions>
 
+  <!--
+    Main definition that uses layout.html to put title and content attributes from
+    Thymeleaf fragments; {1} will be evaluated to either 'list', 'form' or 'view'.
+  -->
+  <definition name="*" template="templates/layout">
+    <put-attribute name="title" value="title/{1}"/>
+    <put-attribute name="content" value="content/{1}"/>
+  </definition>
+
+  <!--
+    Fragments that are included by messages/* definition above;
+    'template' attribute is a template file stored in /WEB-INF/views/message folder;
+    {1} will be evaluated to either 'list', 'form' or 'view'.
+  -->
+  <definition name="title/*" template="views/{1} :: title"/>
+  <definition name="content/*" template="views/{1} :: content"/>
+
   <definition name="BASEPAGE" template="/WEB-INF/templates/html5page.jsp">
     <put-attribute name="title" value="TITLE IS MISSING" type="string" cascade="true"/>
     <put-attribute name="htmlhead" value="/WEB-INF/templates/html-head.jsp" type="template"/>
   <definition name="BASEPAGE" template="/WEB-INF/templates/html5page.jsp">
     <put-attribute name="title" value="TITLE IS MISSING" type="string" cascade="true"/>
     <put-attribute name="htmlhead" value="/WEB-INF/templates/html-head.jsp" type="template"/>