Simple Tiles 2 Spring MVC Webapp

David Winterfeldt


This is a simple example showing how to setup Spring MVC to use Tiles 2. Any request coming in mapped for Tiles processing will attempt to find a Tiles definition that matches the request and then render it.

1. Spring Configuration

The tilesConfigurer bean initializes tiles with all the tiles configuration files (more than one can be specified). The tilesViewResolver bean defines using Spring's TilesView which uses the url to lookup the Tiles definition and render it.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

    <bean id="tilesConfigurer"
        <property name="definitions">

    <bean id="tilesViewResolver"
        <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" />

    <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
                <prop key="/**/*.html">viewController</prop>

    <bean id="viewController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/>