简体   繁体   中英

Spring MVC 3.0 and Apache Tiles 2

I'm currently in a Spring MVC 3 based project, and found out about Apache Tiles 2 the other day,

I think Tiles 2 is a heck of framework that I could make good use in my project, but before I commit to it, I would like to know if it integrates well with Spring MVC 3, given that Tiles' inherent relationship with Struts. Spring also seems to have issues with some frameworks, so better careful than sorry I guess.

So, how's your experience with Spring, Spring MVC 3 and Tiles 2 together?

Thanks!

Spring MVC and Tiles go great together. Spring MVC treats tiles definitions as views, and the two integrates smoothly. Start with the Spring Reference . There are quite a few examples out there to guide you.

They integrate really well together. You can start with this example , really straightforward. You just need to configure your web-app-config.xml (Spring config), your tiles-defs.xml (Tiles config) and then you can start implementing your JSPs (using tiles tag).

If you're using Maven, you just need to add those dependencies to your Spring project for Tiles2:

    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-jsp</artifactId>
        <version>2.2.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-template</artifactId>
        <version>2.2.2</version>
    </dependency>

In Addition to sebarmeli I would like to mention, that tiles also needs the slf4j logging framework:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.5.8</version>
    <scope>compile</scope>
</dependency>

And you probably want to use jstl as well:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM