This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Is one really better than the other? Or maybe I should say, what does Tiles do for me that jsp by itself won't allow? I am looking for a good templating style to really seperate my html from my logic. So that my web app can be customized really easily without someone screwing with the complex code. PHP uses several but the one I have used is called Smarty. I have looked at the Tiles syntax and API and I am initially not that impressed with it. It seems that I can do the same things with pure jsp just as easily. Am I wrong?
Is one really better than the other? Or maybe I should say, what does Tiles do for me that jsp by itself won't allow?
Hi Greg, The selling point of Tiles for me is threefold: 1. I can specify my Tiles layout in the tiles-def.xml file. Thus, apart from creating JSP pages for the base-level include files, I can stick to working with the tiles-def.xml file and let Struts worry about creating the layout JSP files. 2. The JSP Tile files created by Struts are cached by the servlet for nice performance. 3. The tiles-def.xml file allows for hierarchical overloading of tiles. For instance, if I have a base layout A that includes three tiles x, y, and z, then I can create another layout B that subclasses layout A, such that tiles x and y are included in layout B but tile z is overloaded with another tile w. I find this tremendously useful -- not only because it allows me to create hierarchical relationships between JSP pages but because I can use the tile breakdown to create corresponding Value Objects and so better align my JSP pages with my codebase.
I am looking for a good templating style to really seperate my html from my logic. So that my web app can be customized really easily without someone screwing with the complex code.
That's where tiles-def.xml comes in.
If you search my previous posts you should find one or two of them that refer to a free downloadable PDF version of Manning's Struts chapter on Tiles. It is an excellent read and explains how to use the XML-based hierarchical features of Tiles. I hope this is helpful. Darryl