Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pros and Cons of Apache Tiles framework

Tags:

apache-tiles

Greetings for the day, I was just trying to find out pros and cons of using Apache Tiles framework. Please let me know your valuable suggestions, comments, inputs regarding the same.

like image 349
Shahids Avatar asked Jan 23 '13 06:01

Shahids


People also ask

What is Apache Tiles framework?

Apache Tiles is a template composition framework. Tiles was originally built to simplify the development of web application user interfaces, but it is no longer restricted to the JavaEE web environment. Tiles allows authors to define page fragments which can be assembled into a complete page at runtime.

Is Apache Tiles retired?

So Apache Tiles has retired. I'm using Spring MVC framework and JSP. What alternatives are there? I saw Sitemesh, but it is a decorator and I need a template framework.

Why we use tiles in Java?

Advantage of Tiles support in Spring MVCReusability: We can reuse a single component in multiple pages like header and footer components. Centralized control: We can control the layout of the page by a single template page only.


2 Answers

(similar to this)

With Tiles, it seems that when I have 100 actions I need to creates 100 jsp files and create 100 definitions in tiles.xml - true, unfortunately

This is not true. And a common lingering misconception about tiles.

Such boilerplate configuration is a hang-up from tiles-1 days. It really isn't necessary with tiles-2 when wildcards were introduced, and especially with tiles-3 along with the OptionsRenderer.

Here's a tutorial that will help you with

  • spring to tiles integration,
  • definitions with wildcards,
  • implementing a fallback pattern using the OptionsRenderer, and
  • definitions composition.
like image 76
mck Avatar answered Sep 29 '22 08:09

mck


I'm been using Apache Tiles for a non-commercial project and I'm becoming less enthusiastic with it every week. But this may be caused by very basic documentation, too few examples (and no examples on advanced topics) and quite a small community.

Besides, I'd recommend you to look at those resources:

  • Better alternative to Apache Tiles - With Tiles, it seems that when I have 100 actions I need to creates 100 jsp files and create 100 definitions in tiles.xml - true, unfortunately

  • http://blog.springsource.org/2012/10/30/spring-mvc-from-jsp-and-tiles-to-thymeleaf/ - The Apache Tiles approach is similar to custom tags and therefore has same pros and cons. There is some activity on the Apache Tiles project but it is definitely not as vibrant as ThymeLeaf

To sum up - advantages:

  • ability to build up complex (composite) views out of basic views, UI reuse
  • it's been around for some time and it's supported in some major frameworks, such as Spring (it's easy to start with it)

disadvantages:

  • small community, not very active IMHO
  • basic docs, few examples, difficult to find valuable up-to-date resources on the web - you'll be forced to dive deeply into Java interfaces and classes all the time to find what apache tiles provides
  • composite view instead of decorator - in my private opinion the decorator pattern is more flexible - you may define variables, slots, attributes, etc. in the very end of the request handling, whereas in composite view you need to focus on when you define the attribute (all attributes of a sub-view have to be defined before it's rendered - attributes overriding is more difficult)
like image 34
ducin Avatar answered Sep 29 '22 08:09

ducin