Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Main
Mojavelinux




JSPWiki v2.2.33

[RSS]


Hide Menu

TileForwards


This is version 3. It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]


...and why they are an indirection

When I first laid my eyes on Tiles, I knew right away I had finally found the key to a good view. Only problem was, while a very simple example looked easy enough to implement, I quickly began to realize that there was more to understand about how to make tiles work for you. Simply put, Tiles can keep you up many a night wondering how exactly to insert attributes and where to do it. So here is my little rant on the indirection of TileForwards and hopefully will save you some sleep over it.

Here is the story. There are two ways to implement tiles on a jsp page. You can either define and forward to the page as a definition in the tiles-defs.xml which specifies the different components to "plugin" or you can forward to a jsp page which specifies which tiles layout definition should be used to apply page content to. I tried the first way when I started out. The problem with this is that to add a page it is necessary to alter the tiles-defs.xml file, which of course requires some sort of reload. Next, it means that each page must have a tiles definition and a jsp content page. You might think, well, the jsp content page is then reusable. Well, not really, because unless your website consists of a lot of duplicate pages (which would make no sense, think about it) there is no need for that. Of course, you will have reusable components, but the unique part will be unique, so why not just make a jsp page that hosts that content and then plugs itself into a layout? Using the tiles definition is what one person I know refers to as "an indirection." It doesn't actually buy you anything and therefore is not worth doing, especially when the jsp designer is complaining about Tiles again.

So besides the indirection, what difference does it make? Well, I have more for you. Conditionals! When putting together the tiles definitions, you cannot possibly know the state of the beans in your page. What happens if a tile should only be included for administrators, or you want to display a message tile depending on whether or not there are error messages? Truth of the matter is, it makes it impossible to change the ""put"" statements at this point since you would not have access to the tiles definition in your jsp (using the tile forward concept).

So this is a bit broken up and I hope to refine it, but in short, the best way I believe to do tiles is to use the tiles:insert tag in your jsp page. This does not mean you cannot setup layouts and blocks in your tiles-defs.xml file, but it just doesn't make sense to define pages there.

~ Mojavelinux



Go to top   More info...   Attach file...
This particular version was published on 06-Nov-2006 13:52:38 MST by 162.95.80.198.