October 2017
Intermediate to advanced
396 pages
10h 2m
English
Let's configure Apache Tiles in the Spring MVC application. In order to configure it, we have to configure two beans in the Spring configuration file as follows:
package com.packt.patterninspring.chapter10.bankapp.web.mvc;
.....
@Configuration
@ComponentScan(basePackages = {"com.packt.patterninspring.chapter10.bankapp.web.controller"})
@EnableWebMvc
public class SpringMvcConfig extends WebMvcConfigurerAdapter{
.....
@Bean
public TilesConfigurer tilesConfigurer() {
TilesConfigurer tiles = new TilesConfigurer();
tiles.setDefinitions(new String[] {
"/WEB-INF/layout/tiles.xml"
});
tiles.setCheckRefresh(true);
return tiles;
}
@Bean
public ViewResolver viewResolver() {
return new TilesViewResolver();
}
...
} Read now
Unlock full access