Configuring Apache Tiles to Avoid Caching During Development

When you want to use Apache Tiles, you will find that your tiles are cached and are not refershed when you reload the page in web browser.

This is a non-issue in production environment because once your webapp is deployed in production you never change your Apache Tiles templates and pages. However, in a development environment this is cumbersome since you will have to redeploy your webapp each time you make a change in your templates.

I faced a similar problem recently and the I found out the I could use the 'useMutableTilesContainer' property in TilesConfigurer class and the 'cache' property in TilesViewResolver class.

You configuration should look something like this:

       <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
          <property name="definitions">
          <property name="useMutableTilesContainer" value="true" />

<bean id="viewResolver" class="org.springframework.web.servlet.view.tiles3.TilesViewResolver">
      <property name="viewClass">
      <property name="cache" value="false" />

I hope that this helps somebody facing caching problem in Apache Tiles during development.

Basically you have to set 'useMutableTilesContainer' to true and the 'cache' property to false.

The 'useMutableTilesContainer' property is in TilesConfigurer class and the 'cache' property is in TilesViewResolver class.

Happy Coding!

Popular posts from this blog

Installing ColdFusion on IIS 7 + Configure IIS for ColdFusion in Windows Vista and Windows Server 2008

ColdFusion Manual Configuration & Issues with TCP ports 51011, 51010 and 51800 on IIS and Apache

Solution to 500 Internal Server Error issue with ColdFusion, IIS7 and Vista 64bit edition