Merge pull request #4497 from eugenp/update-tiles

move tiles to mvc simple
This commit is contained in:
Loredana Crusoveanu 2018-06-17 14:54:09 +03:00 committed by GitHub
commit 659cf0fc23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 186 additions and 294 deletions

View File

@ -183,7 +183,6 @@
<module>spring-mvc-forms-jsp</module>
<module>spring-mvc-forms-thymeleaf</module>
<module>spring-mvc-java</module>
<module>spring-mvc-tiles</module>
<module>spring-mvc-velocity</module>
<module>spring-mvc-webflow</module>
<module>spring-mvc-xml</module>

View File

@ -4,3 +4,4 @@
- [Template Engines for Spring](http://www.baeldung.com/spring-template-engines)
- [Spring 5 and Servlet 4 The PushBuilder](http://www.baeldung.com/spring-5-push)
- [Servlet Redirect vs Forward](http://www.baeldung.com/servlet-redirect-forward)
- [Apache Tiles Integration with Spring MVC](http://www.baeldung.com/spring-mvc-apache-tiles)

View File

@ -89,6 +89,12 @@
<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>
@ -181,6 +187,7 @@
<scribejava.version>5.1.0</scribejava.version>
<json.version>20180130</json.version>
<spring-oxm.version>5.0.2.RELEASE</spring-oxm.version>
<apache-tiles.version>3.0.8</apache-tiles.version>
</properties>
</project>

View File

@ -1,4 +1,4 @@
package com.baeldung.tiles.springmvc;
package com.baeldung.spring.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -6,14 +6,14 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.tiles3.TilesConfigurer;
import org.springframework.web.servlet.view.tiles3.TilesViewResolver;
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.baeldung.tiles.springmvc")
public class ApplicationConfiguration extends WebMvcConfigurerAdapter {
@ComponentScan(basePackages = "com.baeldung.spring.controller.tiles")
public class TilesApplicationConfiguration implements WebMvcConfigurer {
/**
* Configure TilesConfigurer.

View File

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

View File

@ -1,4 +1,4 @@
package com.baeldung.tiles.springmvc;
package com.baeldung.spring.controller.tiles;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping("/")
public class ApplicationController {
public class TilesController {
@RequestMapping(value = { "/" }, method = RequestMethod.GET)
public String homePage(ModelMap model) {

View File

@ -1,2 +0,0 @@
###Relevant Articles:
- [Apache Tiles Integration with Spring MVC](http://www.baeldung.com/spring-mvc-apache-tiles)

View File

@ -1,93 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung</groupId>
<artifactId>spring-mvc-tiles</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>spring-mvc-tiles</name>
<description>Integrating Spring MVC with Apache Tiles</description>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-spring-4</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-spring-4</relativePath>
</parent>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Apache Tiles -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>${apache-tiles.version}</version>
</dependency>
<!-- Servlet+JSP+JSTL -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax.servlet-api.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>${javax.servlet.jsp-api.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<warName>spring-mvc-tiles</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<finalName>spring-mvc-tiles</finalName>
</build>
<properties>
<apache-tiles.version>3.0.7</apache-tiles.version>
<javax.servlet-api.version>3.1.0</javax.servlet-api.version>
<javax.servlet.jsp-api.version>2.3.1</javax.servlet.jsp-api.version>
<jstl.version>1.2</jstl.version>
<maven-war-plugin.version>2.6</maven-war-plugin.version>
</properties>
</project>

View File

@ -1,22 +0,0 @@
package com.baeldung.tiles.springmvc;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
public class ApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class[] { ApplicationConfiguration.class };
}
@Override
protected Class<?>[] getServletConfigClasses() {
return null;
}
@Override
protected String[] getServletMappings() {
return new String[] { "/" };
}
}