moved apache tiles related code in spring-mvc-views module

This commit is contained in:
amit.pandey 2020-06-21 22:10:19 +05:30
parent 118786c62a
commit 6d4b45e1aa
17 changed files with 72 additions and 13 deletions

View File

@ -7,7 +7,6 @@ This module contains articles about Spring MVC
- [Template Engines for Spring](https://www.baeldung.com/spring-template-engines)
- [Spring 5 and Servlet 4 The PushBuilder](https://www.baeldung.com/spring-5-push)
- [Servlet Redirect vs Forward](https://www.baeldung.com/servlet-redirect-forward)
- [Apache Tiles Integration with Spring MVC](https://www.baeldung.com/spring-mvc-apache-tiles)
- [Guide to Spring Email](https://www.baeldung.com/spring-email)
- [Using ThymeLeaf and FreeMarker Emails Templates with Spring](https://www.baeldung.com/spring-email-templates)
- [Request Method Not Supported (405) in Spring](https://www.baeldung.com/spring-request-method-not-supported-405)

View File

@ -99,12 +99,6 @@
<version>${jade.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>${apache-tiles.version}</version>
</dependency>
<!--Testing -->
<dependency>
<groupId>org.springframework</groupId>
@ -178,7 +172,6 @@
<xstream.version>1.4.9</xstream.version>
<scribejava.version>5.1.0</scribejava.version>
<json.version>20180130</json.version>
<apache-tiles.version>3.0.8</apache-tiles.version>
<javax.mail.version>1.6.1</javax.mail.version>
</properties>

View File

@ -23,8 +23,6 @@ public class WebInitializer implements WebApplicationInitializer {
ctx.register(EmailConfiguration.class);
// ctx.setServletContext(container);
//ctx.register(TilesApplicationConfiguration.class);
// Manage the lifecycle of the root application context
container.addListener(new ContextLoaderListener(ctx));

View File

@ -1,3 +1,4 @@
### Relevant Articles:
- [Spring MVC Themes](https://www.baeldung.com/spring-mvc-themes)
- [Apache Tiles Integration with Spring MVC](https://www.baeldung.com/spring-mvc-apache-tiles)

View File

@ -75,6 +75,12 @@
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>${apache-tiles.version}</version>
</dependency>
</dependencies>
<build>
@ -115,6 +121,7 @@
<hsqldb.version>2.5.0</hsqldb.version>
<hibernate.version>5.4.9.Final</hibernate.version>
<deploy-path>enter-location-of-server</deploy-path>
<apache-tiles.version>3.0.8</apache-tiles.version>
</properties>
</project>

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.configuration;
package com.baeldung.themes.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -12,7 +12,7 @@ import org.springframework.web.servlet.view.tiles3.TilesViewResolver;
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.baeldung.spring.controller.tiles")
@ComponentScan(basePackages = "com.baeldung.themes")
public class TilesApplicationConfiguration implements WebMvcConfigurer {
/**

View File

@ -14,6 +14,7 @@ public class WebInitializer implements WebApplicationInitializer {
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
context.register(DataSourceConfig.class);
context.register(ThemeMVCConfig.class);
//context.register(TilesApplicationConfiguration.class);
servletContext.addListener(new ContextLoaderListener(context));

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.controller.tiles;
package com.baeldung.themes.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;

View File

@ -0,0 +1,12 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Home</title>
</head>
<body>
<h2>Welcome to Apache Tiles integration with Spring MVC</h2>
</body>
</html>

View File

@ -0,0 +1,12 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Spring MVC</title>
</head>
<body>
<h2>Spring MVC configured to work with Apache Tiles</h2>
</body>
</html>

View File

@ -0,0 +1,36 @@
.flex-container {
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
text-align: center;
}
.flex-container > * {
padding: 15px;
-webkit-flex: 1 100%;
flex: 1 100%;
}
.article {
text-align: left;
}
header {background: black;color:white;}
footer {background: #aaa;color:white;}
.nav {background:#eee;}
.nav ul {
list-style-type: none;
padding: 0;
}
.nav ul a {
text-decoration: none;
}
@media all and (min-width: 768px) {
.nav {text-align:left;-webkit-flex: 1 auto;flex:1 auto;-webkit-order:1;order:1;}
.article {-webkit-flex:5 0px;flex:5 0px;-webkit-order:2;order:2;}
footer {-webkit-order:3;order:3;}
}