3

Why do anyone needs tiles if same effect could be achieved with simple custom tags with "fragment" attribute?

Tags even have several advantages over tiles:

  • Only result pages are ".jspx". Includes are ".tagx" files so you distinguish clearly pages and includes. Nobody wants to include the whole page into another in real project.

  • You need less libraries

  • All IDEs have JSP support but not all of them supports tiles. Idea has no such support (except buggy outdated plugin which does nothing actually).

Why do you choose tiles? How does it help you?

user996142
  • 2,753
  • 3
  • 29
  • 48
  • Tiles may have more features, but I would choose tag files by default. Tag files == less features, less to learn, better IDE support, no external dependencies. Check out https://stackoverflow.com/a/3257426/37572 to judge whether tag files are powerful enough for your needs. – John Rees Apr 13 '18 at 05:37

1 Answers1

3

Tiles offers built-in support for FreeMarker and Velocity. Tiles leverages OGNL and MVEL for some interesting games in definition files. IMO Tiles supplies a better model of re-use and composition. Tiles supports cleaner extension (component "subclassing"). Tiles allows custom rendering of attributes.

A fun one is that Tiles allows definitions to be loaded from a DB rather than specified in files.

I think JSP tag-based composition is appropriate when things are relatively straight-forward, but the ability to subclass and extend definitions, along with the interesting configuration games, makes it a better choice (between the two) for more complex applications.

IMO the more interesting question is comparing it to things like SiteMesh, JSF, and client-side components.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Dave Newton
  • 158,873
  • 26
  • 254
  • 302