<slf4j.version>1.6.1</slf4j.version>
<springframework.version>4.0.6.RELEASE</springframework.version>
<thymeleaf.version>2.1.3.RELEASE</thymeleaf.version>
+ <thymeleaf-extras.version>2.1.1.RELEASE</thymeleaf-extras.version>
+ <tiles.version>2.2.2</tiles.version>
<wro4j.version>1.7.3-SNAPSHOT</wro4j.version>
</properties>
<version>${thymeleaf.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.thymeleaf.extras</groupId>
+ <artifactId>thymeleaf-extras-tiles2</artifactId>
+ <version>${thymeleaf-extras.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.thymeleaf</groupId>
+ <artifactId>thymeleaf</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.thymeleaf</groupId>
+ <artifactId>thymeleaf-spring4</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.thymeleaf.extras</groupId>
+ <artifactId>thymeleaf-extras-tiles2-spring4</artifactId>
+ <version>${thymeleaf-extras.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.thymeleaf</groupId>
+ <artifactId>thymeleaf</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.thymeleaf</groupId>
+ <artifactId>thymeleaf-spring4</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- Tiles -->
+ <dependency>
+ <groupId>org.apache.tiles</groupId>
+ <artifactId>tiles-core</artifactId>
+ <version>${tiles.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>runtime</scope>
+ </dependency>
<!-- Servlet -->
<dependency>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util-4.0.xsd
">
<!-- Damit das DispatcherServlet auf /* gemappt werden kann -->
<!-- Thymeleaf Spring-View-Resolver -->
<bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
<property name="templateEngine" ref="templateEngine" />
+ <property name="viewNames" value="views/*,templates/*"/>
+ <property name="order" value="1"/>
+ </bean>
+
+ <!-- Thymeleaf Tiles-View-Resolver -->
+ <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
+ <property name="templateEngine" ref="templateEngine" />
+ <property name="viewClass" value="org.thymeleaf.extras.tiles2.spring4.web.view.ThymeleafTilesView"/>
+ <property name="order" value="2"/>
+ </bean>
+
+
+ <!-- Thymeleaf Tiles-Configurer -->
+ <bean class="org.thymeleaf.extras.tiles2.spring4.web.configurer.ThymeleafTilesConfigurer">
+ <property name="definitions">
+ <list>
+ <value>classpath:/spring/tiles.xml</value>
+ </list>
+ </property>
+ <property name="useMutableTilesContainer" value="true"/>
</bean>
<!-- Thymeleaf Spring4-Template-Engine -->
<bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
<property name="templateResolver" ref="templateResolver" />
+ <property name="additionalDialects">
+ <util:set>
+ <bean class="org.thymeleaf.extras.tiles2.dialect.TilesDialect"/>
+ </util:set>
+ </property>
</bean>
</beans>
<?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>
+ <!--
+ 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"/>
+++ /dev/null
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
- <head>
- <title th:replace="views/404 :: title">TITLE</title>
- <meta charset="UTF-8"/>
- <meta name="viewport" content="width=device-width"/>
- </head>
- <body>
- <div th:replace="templates/header :: fragment">HEADER</div>
- <h1 th:include="views/404 :: title">TITLE</h1>
- <div th:replace="views/404 :: content">CONTENT</div>
- <div th:replace="templates/footer :: fragment">FOOTER</div>
- </body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
- <head>
- <title th:replace="views/error :: title">TITLE</title>
- <meta charset="UTF-8"/>
- <meta name="viewport" content="width=device-width"/>
- </head>
- <body>
- <div th:replace="templates/header :: fragment">HEADER</div>
- <h1 th:include="views/error :: title">TITLE</h1>
- <div th:replace="views/error :: content">CONTENT</div>
- <div th:replace="templates/footer :: fragment">FOOTER</div>
- </body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
- <head>
- <title th:replace="views/index :: title">TITLE</title>
- <meta charset="UTF-8"/>
- <meta name="viewport" content="width=device-width"/>
- </head>
- <body>
- <div th:replace="templates/header :: fragment">HEADER</div>
- <h1 th:include="views/index :: title">TITLE</h1>
- <div th:replace="views/index :: content">CONTENT</div>
- <div th:replace="templates/footer :: fragment">FOOTER</div>
- </body>
-</html>
--- /dev/null
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:tiles="http://www.thymeleaf.org">
+ <head>
+ <!--/* Tiles attribute will be put here at runtime */-->
+ <title tiles:include="title">Title</title>
+ </head>
+ <body>
+ <!--/* Standard layout can be mixed with Tiles */-->
+ <div th:replace="templates/header :: fragment">HEADER</div>
+ <div class="container">
+ <!--/* Tiles attribute will be put here at runtime */-->
+ <h1 tiles:include="title">Title</h1>
+ <!--/* Tiles attribute will be put here at runtime */-->
+ <div tiles:replace="content">
+ <!-- ============================================================================ -->
+ <!-- This content is only used for static prototyping purposes (natural templates)-->
+ <!-- and is therefore entirely optional, as this markup fragment will be included -->
+ <!-- from "fragments/header.html" at runtime. -->
+ <!-- ============================================================================ -->
+ <h1>Content</h1>
+ <p>
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Praesent scelerisque neque neque, ac elementum quam dignissim interdum.
+ Phasellus et placerat elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Praesent scelerisque neque neque, ac elementum quam dignissim interdum.
+ Phasellus et placerat elit.
+ </p>
+ </div>
+ </div>
+ <!--/* Standard layout can be mixed with Tiles */-->
+ <div th:replace="templates/footer :: fragment">FOOTER</div>
+ </body>
+</html>
\ No newline at end of file
<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:tiles="http://www.thymeleaf.org">
<head>
- <title th:fragment="title">404: Page not found</title>
+ <title tiles:fragment="title">404: Page not found</title>
</head>
<body>
- <div th:fragment="content">
+ <div tiles:fragment="content">
<p>We do not know, where you are.</p>
<p>And we do not know, why you are here.</p>
<p>But we can tell you: WE ARE SORRY!</p>
<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:tiles="http://www.thymeleaf.org">
<head>
- <title th:fragment="title">An unexpected Error occured!</title>
+ <title tiles:fragment="title">An unexpected Error occured!</title>
</head>
<body>
- <div th:fragment="content">
+ <div tiles:fragment="content">
<p>We do not know, what happend.</p>
<p>But we can tell you: WE ARE SORRY!</p>
<p>Really.</p>
<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:tiles="http://www.thymeleaf.org">
<head>
- <title th:fragment="title">Index</title>
+ <title tiles:fragment="title">Index</title>
</head>
<body>
- <div th:fragment="content">
+ <div tiles:fragment="content">
<p>Inhalt der Index-Seite...</p>
</div>
</body>