Tom Tucker
Tom Tucker

Reputation: 11896

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!

Upvotes: 10

Views: 6573

Answers (3)

lanoxx
lanoxx

Reputation: 13041

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>

Upvotes: 0

sebarmeli
sebarmeli

Reputation: 18265

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>

Upvotes: 3

earldouglas
earldouglas

Reputation: 13473

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.

Upvotes: 7

Related Questions