tiles white - How to reuse Tiles definitions using wildcard

How to reuse Tiles definitions using wildcard

Posted on

tiles white - How to reuse Tiles definitions using wildcard

If you are developing project in java/j2ee and using Tiles then you are aware of Tiles definition XML file. Being Templating framework, Tiles used one definition per view to render output. User can extend this definition with a defined template so all the common pages will be rendered by the template but still you need one definition per jsp.

spring tiles reuse definitions - How to reuse Tiles definitions using wildcard

Consider a scenario where you have three user roles (admin, manager, and employee) and for each you have created a separate jsp. With this requirement you might end up with such tiles definitions.

Tiles v2.2 comes with the wildcard character support in definitions name. With the above scenario, we can make these three definitions into one using wildcard.

Spring configuration xml file

I have used Spring MVC to integrate Tiles and used Spring view controller to avoid creating java Controller.

Output:

tiles definition reuse - How to reuse Tiles definitions using wildcard

Download Source (size: 60 Kb)

Download WAR (size: 4.61 Mb)

Source techzoo.org