Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate Spring 4 with Apache Tiles 3?

I am using Spring framework version 4 and I get confused which folder to put the XML files, specially the tile definitions and where to find the resolver bean.

like image 290
Andoy Abarquez Avatar asked Dec 25 '22 05:12

Andoy Abarquez


1 Answers

The tile definition xml is specified when you define the TilesConfigurer bean. If you are using Java-based configuration this would look like:

@Bean
public TilesConfigurer tilesConfigurer(){
    TilesConfigurer tilesConfigurer = new TilesConfigurer();
    tilesConfigurer.setDefinitions(new String[] {"/WEB-INF/**/tiles.xml"});
    tilesConfigurer.setCheckRefresh(true);
    return tilesConfigurer;
}

If you are using xml-based configuration this would look like:

<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
    <property name="definitions">
        <list>
            <value>/WEB-INF/views/**/tiles.xml</value>
        </list>
    </property>
</bean>

When you specify /WEB-INF/views/**/tiles.xml, you are telling the TilesConfigurer to look for all tiles definitions recursively under the /Web-INF/views directory.

like image 117
MGB Avatar answered Dec 28 '22 05:12

MGB