With a page template, avoid repeating the common elements of the pages (HTML head, header, footer, navigation, and so on) in every JSP.
Here are the steps to use Tiles:
Add the Tiles Maven dependencies in
pom.xml
:<dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-servlet</artifactId> <version>3.0.5</version> </dependency> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-jsp</artifactId> <version>3.0.5</version> </dependency>
In the Spring configuration class, remove the JSP view resolver (if it's there).
Declare Tiles in the Spring configuration class:
// declare Tiles configuration file @Bean public TilesConfigurer tilesConfigurer() { TilesConfigurer tilesConfigurer = new TilesConfigurer(); final String[] definitions = { "/WEB-INF/tiles.xml" }; tilesConfigurer.setDefinitions(definitions); return...