views:

26

answers:

1

I'm writing webapp using Spring 3 MVC with annotations. I use jsp for view layer. I have a few basic templates and many templates that I want to include into this basic templates in depend of controller.

I know that I can add template name to model inside controller, but it is not best way I think. I think some declarative way must exists.

What the best way to do this.

Thanks.

+2  A: 

You may try Apache Tiles (integration with Spring MVC, petcare sample).

With Tiles you can break your templates into subtemplates, assemble them declaratively into tiles' definitions and use definition names as view names returned from controllers.

axtavt
Thanks, but I seek for more lightweight approach. To use Tiles, I must learn how to use it, before.
glebreutov
I have take a quick look at Tiles - it really simple to use. Thanks
glebreutov