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.
(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.
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 ofdecorator
- 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 incomposite 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)
I have been working with tiles for quite some time now and I must say once you get into it and you know all features you will love it. At the beginning it looked so complex and cumbersome and you will spend a lot of time googling. But after that you will leverage amount of great features you wont find in another frameworks or concepts like templates inheritance, overriding, flexible composition, wildcard view matching, view preparers, etc... And it integrates very well with Spring. On the other hand only feature I miss till now is the impossibility to define parent template directly in view (that would actually break the Tiles concept).
© 2022 - 2024 — McMap. All rights reserved.