<jsp-api.version>2.2.1</jsp-api.version>
<jstl.version>1.2</jstl.version>
<servlet-api.version>3.0.1</servlet-api.version>
- <slf4j.version>1.5.8</slf4j.version>
+ <slf4j.version>1.6.1</slf4j.version>
<springframework.version>4.0.6.RELEASE</springframework.version>
- <tiles.version>3.0.1</tiles.version>
+ <thymeleaf.version>2.1.3.RELEASE</thymeleaf.version>
<wro4j.version>1.7.3-SNAPSHOT</wro4j.version>
</properties>
</exclusions>
</dependency>
- <!-- Tiles -->
+ <!-- Thymeleaf -->
<dependency>
- <groupId>org.apache.tiles</groupId>
- <artifactId>tiles-core</artifactId>
- <version>${tiles.version}</version>
+ <groupId>org.thymeleaf</groupId>
+ <artifactId>thymeleaf</artifactId>
+ <version>${thymeleaf.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>org.apache.tiles</groupId>
- <artifactId>tiles-jsp</artifactId>
- <version>${tiles.version}</version>
+ <groupId>org.thymeleaf</groupId>
+ <artifactId>thymeleaf-spring4</artifactId>
+ <version>${thymeleaf.version}</version>
<scope>runtime</scope>
</dependency>
<logger name="org.springframework">
<level value="debug" />
</logger>
+ <logger name="org.thymeleaf">
+ <level value="debug" />
+ </logger>
<root>
<level value="info"/>
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>
+ /thymeleaf/**=staticResources
/*.html=urlFilenameViewController
/**/*.html=urlFilenameViewController
</value>
<property name="order" value="10"/>
</bean>
<bean id="urlFilenameViewController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/>
+ <bean id="staticResources" class="org.springframework.web.servlet.resource.ResourceHttpRequestHandler">
+ <property name="locations">
+ <list>
+ <value>/thymeleaf/</value>
+ </list>
+ </property>
+ </bean>
- <!-- Tiles View-Resolver -->
- <bean class="org.springframework.web.servlet.view.tiles3.TilesViewResolver"/>
+ <!-- Thymeleaf Spring-View-Resolver -->
+ <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
+ <property name="templateEngine" ref="templateEngine" />
+ </bean>
- <!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory -->
- <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
- <property name="prefix" value="/WEB-INF/views/"/>
- <property name="suffix" value=".jsp"/>
+
+ <!-- Thymeleaf Template-Resolver -->
+ <bean id="templateResolver" class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
+ <property name="prefix" value="/thymeleaf/" />
+ <property name="suffix" value=".html" />
+ <property name="templateMode" value="HTML5" />
+ <property name="cacheable" value="false" /><!-- Only for development -->
</bean>
- <bean class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
- <property name="definitions">
- <list>
- <value>classpath:/spring/tiles.xml</value>
- </list>
- </property>
- <property name="useMutableTilesContainer" value="true"/>
+ <!-- Thymeleaf Spring4-Template-Engine -->
+ <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
+ <property name="templateResolver" ref="templateResolver" />
</bean>
</beans>
<servlet-mapping>
<servlet-name>Dispatcher Servlet - Branding</servlet-name>
- <url-pattern>*.html</url-pattern>
+ <url-pattern>/</url-pattern>
</servlet-mapping>
<error-page>
<error-code>404</error-code>
- <location>/WEB-INF/404.jsp</location>
+ <location>/404.html</location>
</error-page>
<error-page>
- <location>/WEB-INF/error.jsp</location>
+ <location>/error.html</location>
</error-page>
</web-app>
--- /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">
+ <head>
+ <title>Footer-Template</title>
+ </head>
+ <body>
+ <footer th:fragment="fragment">
+ <hr />
+ © 2014 juplo NG
+ </footer>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
+ <head>
+ <title>Header-Template</title>
+ </head>
+ <body>
+ <header th:fragment="fragment">
+ juplo proudly presemts:
+ <hr />
+ </header>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
+ <head>
+ <title th:fragment="title">404: Page not found</title>
+ </head>
+ <body>
+ <div th: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>
+ <p>Really.</p>
+ </div>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
+ <head>
+ <title th:fragment="title">An unexpected Error occured!</title>
+ </head>
+ <body>
+ <div th:fragment="content">
+ <p>We do not know, what happend.</p>
+ <p>But we can tell you: WE ARE SORRY!</p>
+ <p>Really.</p>
+ </div>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
+ <head>
+ <title th:fragment="title">Index</title>
+ </head>
+ <body>
+ <div th:fragment="content">
+ <p>Inhalt der Index-Seite...</p>
+ </div>
+ </body>
+</html>