Spring and Tiles – presentation tier in http://www.123urban.ro

1 min read >

Spring and Tiles – presentation tier in http://www.123urban.ro

Engineering Insights & Enterprise solutions

Presentation tier in 123urban – Spring comes to the rescue as usual with its embedded support for Tiles. Basically, the only setting is to change your viewResolver in your -servlet.xml from JstlView to TilesView.

 <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">        
	<property name="requestContextAttribute" value="requestContext"/>        
	<property name="viewClass" value="org.springframework.web.servlet.view.tiles.TilesJstlView"/>    
   </bean>

Notice the use of TilesJstlView a specialization of TilesView which offers support for JSTL pages.

From here on is just as easy as a walk in the park – classic Tiles -> tiles.xml stays in WEB-INF and works like a charm. You should be aware that from now on all your responses will go through Tiles which means all your Spring MVC controllers will have to define their views as being Tiles layouts.