File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Question on Facelets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Question on Facelets" Watch "Question on Facelets" New topic

Question on Facelets

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032


Are Facelets View Definition language something similiar to tiles templating that we do in Struts?

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Bart Kummel
Ranch Hand

Joined: Nov 30, 2007
Posts: 81

Facelets does have a templating mechanism, both on page level and on component level. I do not have experience with Tiles myself, so I can't tell you how Facelets' templating mechanism compares to Tiles.

Best regards,

SCJP 1.4 | SCJD 1.6 | Visit my website | Author of the book Apache MyFaces 1.2 Web Application Development
Tom Fulton
Ranch Hand

Joined: Mar 30, 2006
Posts: 96
It's pretty similar conceptually, with one major difference: Tiles has the ability to "inherit" layouts, while Facelets does not. Apart from that, they can be used in much the same way...create an overall layout, plug in content pages, etc. One difference is that way in which parameters are passed Tiles, you have the tiles scope, but in Facelets you have the ability to specify parameters that are passed through. Again, conceptually similar, with a difference in technique.

Facelets also has something that does not really exist in Tiles: composition components. Suppose you notice a recurring visual effect on a number of pages (such as columns in a data table, or rows in an input form). You can create a component that captures that common structure, re-use it wherever necessary, passing it parameters to tune it to a particular use.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

I have tried to use Tiles in Struts. I have tried to use Tiles in JSF. I've always given up. To me, Tiles requires too much work to define everything properly. YMMV.

The Facelets component-building feature is quite useful. I've got several projects where I've used it to good effect. One of them has a lot of pages that have a small scrollable "help control" in them, and I built the "help control" as a component that gets passed the help topic ID as a parameter..

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Question on Facelets
It's not a secret anymore!