File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes How are tiles different than include? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How are tiles different than include?" Watch "How are tiles different than include?" New topic

How are tiles different than include?

Sehrish Hasan
Ranch Hand

Joined: Aug 15, 2005
Posts: 43
Hi all,

I am a little confused as to why would somebody use tiles over include when working with Struts? What does Tile offer that a simple include doesnt?

Any help is appreciated.

M Hasan.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Maybe you know more about includes than I do. Say you had 50 different pages and each page shared the same basic layout...a banner across the top, a navigation bar on the left side and another bar of links across the bottom of the page. Just using includes, wouldn't you have to have 50 different jsp pages that each included the three common areas? With tiles you have one layout page and you use tiles to define the main content area. Then if you wanted to move the navigation bar from the left to the right you just have one file to change instead of 50.

- Brent
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 544
Tiles is a framework which uses includes internally to do the job. You can create your own as well to achieve this but then it would be like writing a framework similar to struts to do the job.
Moreover tiles does provide a centralized configuration "tiles-def.xml" using which you can organize the layouts and various tiles.
Tiles can extend each other.
You can dynamically control the tile whether to be shown or hidden. The controller classes which are the callbacks before your tile gets rendered are used in doing so.
Maybe there are more than these advantages which tiles can provide instead of homegrown JSP includes. I tried to put over here whatever I know from my experience with tiles framework.

I agree. Here's the link:
subject: How are tiles different than include?
It's not a secret anymore!