Struts Tiles
Hmm. Okay, so Matt published his AppFuse app the other day and I bought Ted Husted's Struts in Action (which, by the way, you can purchase online for half the price. Had I known that I wouldn't have paid the full cover price +40% they charge you in Spain for English-language text books) and both lead me to try out Tiles in my Struts app. I used it at my job last Winter, but with Struts 1.0 so it meant having a separate template .jsp page for each of my real .jsp pages...
Now in Struts 1.1, it's much improved and all the templates definitions are kept in a central xml config file which reduces the number of pages you need to maintain considerably if you want to use it. So last night I moved over what I had done so far to Tiles and now I'm looking at it with my head twitched the side, sucking on my teeth wondering if its a "good thing" or not.
The problem is that I have little idea what the hell Tiles is doing. Conceptually, I get it, but behind the scenes its this black box which give me heebeejeebies. I'm not sure its worth the abstraction, really. Using XHTML means that everything on the page is divided up into divs and that these sections just appear one after another in my .jsp pages with just an included header.jsp and footer.jsp for the surrounding menus, etc. It's tried and tested and not particularly difficult to change something if I need to.
With Tiles, instead of having a "pull" model for page's templates (in other words, the JSP pages include the header and footer), Tiles instead has more of a "push" model, where you can throw any .jsp page fragment (a "tile") within the defined template definitions. It's an *okay* system, but I wonder about how far I'm going to get before I run into 64k tag limits, errors that I can't track down because of the hierarchy of pages, or whether the performance of all my pages is going to drastically suffer becuase of the dynamic inclusion methods used.
I guess I have to play a bit more before I'm comfortable with it. I also need to check out the final version of the .jsp servlet class to see what exactly is being produced by the Tiles system.... I don't like black-box magic in my server code at all.
Okay, back to it.
-Russ