Replace Tiles with Thymeleaf layout

This commit is contained in:
rstoyanchev
2022-07-18 09:31:19 +01:00
parent 6b958aad1e
commit 91a1866e61
23 changed files with 180 additions and 480 deletions

View File

@@ -72,7 +72,7 @@
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>2.1.5.RELEASE</version>
<version>3.1.0.M1</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>

View File

@@ -21,7 +21,7 @@ public class HotelsController {
}
@GetMapping("/hotels/search")
public void search(SearchCriteria searchCriteria, Principal currentUser, Model model) {
public void search(@SuppressWarnings("unused") SearchCriteria searchCriteria, Principal currentUser, Model model) {
if (currentUser != null) {
List<Booking> booking = bookingService.findBookings(currentUser.getName());
model.addAttribute(booking);

View File

@@ -5,6 +5,7 @@ import org.springframework.security.config.annotation.authentication.builders.Au
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
@Configuration
@EnableWebSecurity
@@ -20,7 +21,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.failureUrl("/login?login_error=1")
.and()
.logout()
.logoutUrl("/logout")
.logoutRequestMatcher(new AntPathRequestMatcher("/logout", "GET"))
.logoutSuccessUrl("/logoutSuccess");
}

View File

@@ -45,7 +45,7 @@ public class WebFlowConfig extends AbstractFlowConfiguration {
@Bean
public MvcViewFactoryCreator mvcViewFactoryCreator() {
MvcViewFactoryCreator factoryCreator = new MvcViewFactoryCreator();
factoryCreator.setViewResolvers(Collections.singletonList(this.webMvcConfig.tilesViewResolver()));
factoryCreator.setViewResolvers(Collections.singletonList(this.webMvcConfig.thymeleafViewResolver()));
factoryCreator.setUseSpringBeanBinding(true);
return factoryCreator;
}

View File

@@ -3,34 +3,43 @@ package org.springframework.webflow.samples.booking.config;
import java.util.LinkedHashSet;
import java.util.Set;
import jakarta.servlet.ServletContext;
import org.thymeleaf.dialect.IDialect;
import org.thymeleaf.extras.springsecurity6.dialect.SpringSecurityDialect;
import org.thymeleaf.spring6.SpringTemplateEngine;
import org.thymeleaf.spring6.view.AjaxThymeleafViewResolver;
import org.thymeleaf.spring6.view.FlowAjaxThymeleafView;
import org.thymeleaf.templateresolver.WebApplicationTemplateResolver;
import org.thymeleaf.web.IWebApplication;
import org.thymeleaf.web.servlet.JakartaServletWebApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.ServletContextAware;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.webflow.mvc.servlet.FlowHandlerAdapter;
import org.springframework.webflow.mvc.servlet.FlowHandlerMapping;
import org.springframework.webflow.samples.booking.BookingFlowHandler;
import org.thymeleaf.dialect.IDialect;
import org.thymeleaf.extras.conditionalcomments.dialect.ConditionalCommentsDialect;
import org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect;
import org.thymeleaf.extras.tiles2.dialect.TilesDialect;
import org.thymeleaf.extras.tiles2.spring4.web.configurer.ThymeleafTilesConfigurer;
import org.thymeleaf.extras.tiles2.spring4.web.view.FlowAjaxThymeleafTilesView;
import org.thymeleaf.spring4.SpringTemplateEngine;
import org.thymeleaf.spring4.view.AjaxThymeleafViewResolver;
import org.thymeleaf.templateresolver.ServletContextTemplateResolver;
@EnableWebMvc
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
public class WebMvcConfig implements WebMvcConfigurer, ServletContextAware {
@Autowired
private WebFlowConfig webFlowConfig;
private ServletContext servletContext;
@Override
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/", "classpath:/META-INF/web-resources/");
@@ -70,9 +79,9 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
}
@Bean
public AjaxThymeleafViewResolver tilesViewResolver() {
public AjaxThymeleafViewResolver thymeleafViewResolver() {
AjaxThymeleafViewResolver viewResolver = new AjaxThymeleafViewResolver();
viewResolver.setViewClass(FlowAjaxThymeleafTilesView.class);
viewResolver.setViewClass(FlowAjaxThymeleafView.class);
viewResolver.setTemplateEngine(templateEngine());
return viewResolver;
}
@@ -80,10 +89,8 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Bean
public SpringTemplateEngine templateEngine(){
Set<IDialect> dialects = new LinkedHashSet<IDialect>();
dialects.add(new TilesDialect());
Set<IDialect> dialects = new LinkedHashSet<>();
dialects.add(new SpringSecurityDialect());
dialects.add(new ConditionalCommentsDialect());
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(templateResolver());
@@ -92,18 +99,13 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
}
@Bean
public ServletContextTemplateResolver templateResolver() {
ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
templateResolver.setPrefix("/WEB-INF");
templateResolver.setTemplateMode("HTML5");
return templateResolver;
}
@Bean
public ThymeleafTilesConfigurer tilesConfigurer() {
ThymeleafTilesConfigurer configurer = new ThymeleafTilesConfigurer();
configurer.setDefinitions("/WEB-INF/**/views.xml");
return configurer;
public WebApplicationTemplateResolver templateResolver() {
IWebApplication application = JakartaServletWebApplication.buildApplication(this.servletContext);
WebApplicationTemplateResolver resolver = new WebApplicationTemplateResolver(application);
resolver.setPrefix("/WEB-INF/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
return resolver;
}
}

View File

@@ -8,6 +8,7 @@
<Loggers>
<Logger name="org.springframework.samples" level="debug" />
<Logger name="org.springframework.web" level="debug" />
<Logger name="org.thymeleaf.spring6" level="debug" />
<Root level="info">
<AppenderRef ref="Console" />
</Root>

View File

@@ -13,7 +13,7 @@
<evaluate expression="bookingService.createBooking(hotelId, currentUser.name)" result="flowScope.booking" />
</on-start>
<view-state id="enterBookingDetails" model="booking">
<view-state id="enterBookingDetails" model="booking" view="/hotels/booking/enterBookingDetails.html">
<binder>
<binding property="checkinDate" />
<binding property="checkoutDate" />
@@ -32,7 +32,7 @@
<transition on="cancel" to="cancel" bind="false" />
</view-state>
<view-state id="reviewBooking">
<view-state id="reviewBooking" view="/hotels/booking/reviewBooking.html">
<on-render>
<render fragments="body" />
</on-render>

View File

@@ -1,55 +1,36 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:tiles="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org"
lang="en">
<head>
<head th:replace="layouts/standard.html :: //head">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This <head> section is only used for static prototyping purposes. At runtime, -->
<!-- Tiles will only use the body fragment defined with tiles:fragment="content", -->
<!-- as specified at the corresponding views.xml file. -->
<!-- This <head> section is only used for static prototyping purposes. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../../styles/blueprint/screen.css" />
<link rel="stylesheet" type="text/css" media="print"
href="../../../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen"
href="../../../styles/booking.css" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
<!-- runtime. Therefore not available for static prototyping. See the -->
<!-- layouts/standard.html template file for detail. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../../styles/blueprint/screen.css" />
<link rel="stylesheet" type="text/css" media="print"
href="../../../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen" href="../../../styles/booking.css" />
</head>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this -->
<!-- template if no static prototyping was intended. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">
<body th:replace="layouts/standard.html :: body(~{::bodyContent})">
<div id="bookingForm">
<div th:fragment="bodyContent">
<div class="span-5">

View File

@@ -1,53 +1,33 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:tiles="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org"
lang="en">
<head>
<head th:replace="layouts/standard.html :: //head">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This <head> section is only used for static prototyping purposes. At runtime, -->
<!-- Tiles will only use the body fragment defined with tiles:fragment="content", -->
<!-- as specified at the corresponding views.xml file. -->
<!-- This <head> section is only used for static prototyping purposes. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../../styles/blueprint/screen.css" />
<link rel="stylesheet" type="text/css" media="print"
href="../../../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen"
href="../../../styles/booking.css" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
<!-- runtime. Therefore not available for static prototyping. See the -->
<!-- layouts/standard.html template file for detail. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../../styles/blueprint/screen.css" />
<link rel="stylesheet" type="text/css" media="print"
href="../../../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen" href="../../../styles/booking.css" />
</head>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this -->
<!-- template if no static prototyping was intended. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">
<body th:replace="layouts/standard.html :: body(~{::#messages})">
<div id="messages">
@@ -58,8 +38,5 @@
</body>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- END of the content to be included in the execution result -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</html>

View File

@@ -1,55 +1,35 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:tiles="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org"
lang="en">
<head>
<head th:replace="layouts/standard.html :: //head">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This <head> section is only used for static prototyping purposes. At runtime, -->
<!-- Tiles will only use the body fragment defined with tiles:fragment="content", -->
<!-- as specified at the corresponding views.xml file. -->
<!-- This <head> section is only used for static prototyping purposes. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../../styles/blueprint/screen.css" />
<link rel="stylesheet" type="text/css" media="print"
href="../../../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen"
href="../../../styles/booking.css" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
<!-- runtime. Therefore not available for static prototyping. See the -->
<!-- layouts/standard.html template file for detail. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../../styles/blueprint/screen.css" />
<link rel="stylesheet" type="text/css" media="print"
href="../../../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen" href="../../../styles/booking.css" />
</head>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this -->
<!-- template if no static prototyping was intended. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">
<body th:replace="layouts/standard.html :: body(~{::bodyContent})">
<div id="bookingForm">
<div th:fragment="bodyContent">
<div class="span-5">
@@ -126,10 +106,6 @@
</div>
</body>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- END of the content to be included in the execution result -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</html>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"https://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
<definition name="enterBookingDetails" extends="standardLayout" templateType="thymeleaf">
<put-attribute name="body" value="/hotels/booking/enterBookingDetails.html :: content" type="thymeleaf"/>
</definition>
<definition name="reviewBooking" extends="standardLayout" templateType="thymeleaf">
<put-attribute name="body" value="/hotels/booking/reviewBooking.html :: content" type="thymeleaf"/>
</definition>
</tiles-definitions>

View File

@@ -1,16 +1,13 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:tiles="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org"
lang="en">
<head>
<head th:replace="layouts/standard.html :: //head">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This <head> section is only used for static prototyping purposes. At runtime, -->
<!-- Tiles will only use the body fragment defined with tiles:fragment="content", -->
<!-- as specified at the corresponding views.xml file. -->
<!-- This <head> section is only used for static prototyping purposes. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
@@ -26,29 +23,15 @@
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen"
href="../../styles/booking.css" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
<!-- runtime. Therefore not available for static prototyping. See the -->
<!-- layouts/standard.html template file for detail. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<link rel="stylesheet" type="text/css" media="screen" href="../../styles/booking.css" />
</head>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this -->
<!-- template if no static prototyping was intended. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">
<body th:replace="layouts/standard.html :: body(~{::bodyContent})">
<div id="bookings" sec:authorize="hasRole('ROLE_USER')">
<div th:fragment="bodyContent" sec:authorize="hasRole('ROLE_USER')">
<h2>Current Hotel Bookings</h2>
@@ -87,10 +70,6 @@
</div>
</body>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- END of the content to be included in the execution result -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</html>

View File

@@ -1,16 +1,12 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:tiles="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org"
lang="en">
<head>
<head th:replace="layouts/standard.html :: //head">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This <head> section is only used for static prototyping purposes. At runtime, -->
<!-- Tiles will only use the body fragment defined with tiles:fragment="content", -->
<!-- as specified at the corresponding views.xml file. -->
<!-- This <head> section is only used for static prototyping purposes. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
@@ -26,28 +22,14 @@
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen"
href="../../styles/booking.css" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
<!-- runtime. Therefore not available for static prototyping. See the -->
<!-- layouts/standard.html template file for detail. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<link rel="stylesheet" type="text/css" media="screen" href="../styles/booking.css" />
</head>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this -->
<!-- template if no static prototyping was intended. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">
<body th:replace="layouts/standard.html :: body(~{::bodyContent})">
<div th:fragment="bodyContent">
<h1>Hotel Results</h1>
@@ -55,14 +37,12 @@
<a id="changeSearchLink" href="#"
th:href="@{hotels/search(searchString=${searchCriteria.searchString},pageSize=${searchCriteria.pageSize})}">Change Search</a>
<script type="text/javascript">
// <![CDATA[
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId: "changeSearchLink",
event: "onclick",
popup: true,
params: {fragments: "searchForm"}
params: {fragments: "#searchForm"}
}));
// ]]>
</script>
</p>
@@ -100,13 +80,11 @@
<a id="prevResultsLink" href="#"
th:href="@{hotels(searchString=${searchCriteria.searchString},pageSize=${searchCriteria.pageSize},page=${searchCriteria.page - 1})}">Previous Results</a>
<script type="text/javascript">
// <![CDATA[
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId: "prevResultsLink",
event: "onclick",
params: {fragments: "body"}
params: {fragments: "#hotelResults"}
}));
// ]]>
</script>
</div>
</div>
@@ -115,13 +93,11 @@
<a id="moreResultsLink" href="#"
th:href="@{hotels(searchString=${searchCriteria.searchString},pageSize=${searchCriteria.pageSize},page=${searchCriteria.page + 1})}">More Results</a>
<script type="text/javascript">
// <![CDATA[
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId: "moreResultsLink",
event: "onclick",
params: {fragments: "body"}
params: {fragments: "#hotelResults"}
}));
// ]]>
</script>
</div>
</div>
@@ -130,10 +106,8 @@
</div>
</div>
</body>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- END of the content to be included in the execution result -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</html>

View File

@@ -1,16 +1,12 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:tiles="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org"
lang="en">
<head>
<head th:replace="layouts/standard.html :: //head">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This <head> section is only used for static prototyping purposes. At runtime, -->
<!-- Tiles will only use the body fragment defined with tiles:fragment="content", -->
<!-- as specified at the corresponding views.xml file. -->
<!-- This <head> section is only used for static prototyping purposes. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
@@ -27,42 +23,25 @@
href="../../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen"
href="../../styles/booking.css" />
<link rel="stylesheet" type="text/css" media="screen" href="../../styles/booking.css" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
<!-- runtime. Therefore not available for static prototyping. See the -->
<!-- layouts/standard.html template file for detail. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</head>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this -->
<!-- template if no static prototyping was intended. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">
<body th:replace="layouts/standard.html :: body(~{::bodyContent})">
<div th:fragment="bodyContent">
<div tiles:include="searchForm">
<div id="searchForm" th:replace="hotels/searchForm.html :: bodyContent">
A search form will go here. See it at <a href="searchForm.html">searchForm.html</a>.
</div>
<div tiles:include="bookingsTable">
<div th:replace="hotels/bookingsTable.html :: bodyContent">
A table with the current hotel bookings will go here.
See it at <a href="bookingsTable.html">bookingsTable.html</a>.
</div>
</div>
</body>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- END of the content to be included in the execution result -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</html>

View File

@@ -5,12 +5,10 @@
xmlns:sec="http://www.thymeleaf.org"
lang="en">
<head>
<head th:replace="layouts/standard.html :: //head">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This <head> section is only used for static prototyping purposes. At runtime, -->
<!-- Tiles will only use the body fragment defined with tiles:fragment="content", -->
<!-- as specified at the corresponding views.xml file. -->
<!-- This <head> section is only used for static prototyping purposes. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
@@ -26,27 +24,14 @@
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen"
href="../../styles/booking.css" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
<!-- runtime. Therefore not available for static prototyping. See the -->
<!-- layouts/standard.html template file for detail. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<link rel="stylesheet" type="text/css" media="screen" href="../../styles/booking.css" />
</head>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this -->
<!-- template if no static prototyping was intended. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">
<body th:replace="layouts/standard.html :: body(~{::bodyContent})">
<div th:fragment="bodyContent">
<h1>Search Hotels</h1>
@@ -86,10 +71,8 @@
</form>
</div>
</body>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- END of the content to be included in the execution result -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</html>

View File

@@ -5,49 +5,33 @@
xmlns:sec="http://www.thymeleaf.org"
lang="en">
<head>
<head th:replace="layouts/standard.html :: //head">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This <head> section is only used for static prototyping purposes. At runtime, -->
<!-- Tiles will only use the body fragment defined with tiles:fragment="content", -->
<!-- as specified at the corresponding views.xml file. -->
<!-- This <head> section is only used for static prototyping purposes. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../styles/blueprint/screen.css" />
<link rel="stylesheet" type="text/css" media="print"
href="../../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen"
href="../../styles/booking.css" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
<!-- runtime. Therefore not available for static prototyping. See the -->
<!-- layouts/standard.html template file for detail. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../styles/blueprint/screen.css" />
<link rel="stylesheet" type="text/css" media="print"
href="../../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen" href="../../styles/booking.css" />
</head>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this -->
<!-- template if no static prototyping was intended. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">
<body th:replace="layouts/standard.html :: body(~{::bodyContent})">
<div th:fragment="bodyContent">
<h1 th:text="${hotel.name}">The Herb Plaza</h1>
@@ -71,11 +55,8 @@
</div>
</form>
</div>
</body>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- END of the content to be included in the execution result -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</html>

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"https://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
<definition name="hotels/search" extends="standardLayout">
<put-attribute name="body">
<definition template="/hotels/search.html :: content" templateType="thymeleaf">
<put-attribute name="searchForm" value="/hotels/searchForm.html :: content" type="thymeleaf"/>
<put-attribute name="bookingsTable" value="/hotels/bookingsTable.html :: content" type="thymeleaf"/>
</definition>
</put-attribute>
</definition>
<definition name="hotels/*" extends="standardLayout" templateType="thymeleaf">
<put-attribute name="body" value="/hotels/{1}.html :: content" type="thymeleaf"/>
</definition>
</tiles-definitions>

View File

@@ -1,16 +1,12 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:tiles="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org"
lang="en">
<head>
<head th:replace="layouts/standard.html :: //head">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This <head> section is only used for static prototyping purposes. At runtime, -->
<!-- Tiles will only use the body fragment defined with tiles:fragment="content", -->
<!-- as specified at the corresponding views.xml file. -->
<!-- This <head> section is only used for static prototyping purposes. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
@@ -23,31 +19,17 @@
href="../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen"
href="../styles/booking.css" />
<link rel="stylesheet" type="text/css" media="screen" href="../styles/booking.css" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
<!-- runtime. Therefore not available for static prototyping. See the -->
<!-- layouts/standard.html template file for detail. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</head>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this -->
<!-- template if no static prototyping was intended. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">
<body th:replace="layouts/standard.html :: body(~{::bodyContent})">
<div>
<div th:fragment="bodyContent">
<h1>Welcome to Spring Travel</h1>
<p>
This sample demonstrates how to use Spring MVC and Spring Web Flow together with Thymeleaf and Tiles.
@@ -77,10 +59,6 @@
</p>
</div>
</body>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- END of the content to be included in the execution result -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</html>

View File

@@ -1,7 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:tiles="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org"
lang="en">
@@ -41,7 +40,7 @@
</head>
<body class="tundra">
<body class="tundra" th:fragment="body(bodyContent)">
<div id="page" class="container">
@@ -77,16 +76,10 @@
</a>
</p>
</div>
<div id="main" class="span-18 last" tiles:include="body">
<div id="main" class="span-18 last" th:insert="${bodyContent}">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- At runtime, the body of this <div> will be substituted by -->
<!-- Tiles in order to create the final HTML page that will be -->
<!-- sent to the browser. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
BODY PAGE GOES HERE!
</div>
</div>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"https://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
<definition name="standardLayout" template="/layouts/standard.html" templateType="thymeleaf"/>
<!-- <definition name="standardLayoutJSP" template="/WEB-INF/layouts/standard.jsp" templateType="jsp"/> -->
</tiles-definitions>

View File

@@ -1,52 +1,35 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:tiles="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org"
lang="en">
<head>
<head th:replace="layouts/standard.html :: //head">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This <head> section is only used for static prototyping purposes. At runtime, -->
<!-- Tiles will only use the body fragment defined with tiles:fragment="content", -->
<!-- as specified at the corresponding views.xml file. -->
<!-- This <head> section is only used for static prototyping purposes. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../styles/blueprint/screen.css" />
<link rel="stylesheet" type="text/css" media="print"
href="../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen"
href="../styles/booking.css" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
<!-- runtime. Therefore not available for static prototyping. See the -->
<!-- layouts/standard.html template file for detail. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../styles/blueprint/screen.css" />
<link rel="stylesheet" type="text/css" media="print"
href="../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen" href="../styles/booking.css" />
</head>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this -->
<!-- template if no static prototyping was intended. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">
<body th:replace="layouts/standard.html :: body(~{::bodyContent})">
<div th:fragment="bodyContent">
<div class="span-5">
<p>Valid username/passwords are:</p>
@@ -127,6 +110,7 @@
</div>
</div>
</body>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

View File

@@ -2,53 +2,35 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:tiles="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org"
lang="en">
<head>
<head th:replace="layouts/standard.html :: //head">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This <head> section is only used for static prototyping purposes. At runtime, -->
<!-- Tiles will only use the body fragment defined with tiles:fragment="content", -->
<!-- as specified at the corresponding views.xml file. -->
<!-- This <head> section is only used for static prototyping purposes. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../styles/blueprint/screen.css" />
<link rel="stylesheet" type="text/css" media="print"
href="../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen"
href="../styles/booking.css" />
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
<!-- runtime. Therefore not available for static prototyping. See the -->
<!-- layouts/standard.html template file for detail. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../styles/blueprint/screen.css" />
<link rel="stylesheet" type="text/css" media="print"
href="../styles/blueprint/print.css" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen, projection"
href="../styles/blueprint/ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" media="screen" href="../styles/booking.css" />
</head>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this -->
<!-- template if no static prototyping was intended. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">
<body th:replace="layouts/standard.html :: body(~{::bodyContent})">
<div>
<div th:fragment="bodyContent">
<h1>Logout</h1>
<p>You have successfully logged out.</p>
<hr />
@@ -57,8 +39,5 @@
</body>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- END of the content to be included in the execution result -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</html>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"https://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
<definition name="intro" extends="standardLayout">
<put-attribute name="body" value="/intro.html :: content" type="thymeleaf"/>
</definition>
<definition name="login" extends="standardLayout">
<put-attribute name="body" value="/login.html :: content" type="thymeleaf"/>
</definition>
<definition name="logoutSuccess" extends="standardLayout">
<put-attribute name="body" value="/logoutSuccess.html :: content" type="thymeleaf"/>
</definition>
</tiles-definitions>