John,

John Patterson wrote:
From my (limited) understanding, Tiles you have to 'push' everything
into it.  If you want a title - you need to specify it in tiles-def.xml.
 I'm not sure what Tiles gives you that you couldn't achieve with a big
velocity template & a properties file to pull the value in from.


Generally in your tiles definition file you specify not only text properties
to place in the template (eg title) but what *tiles components* should be
used (eg 'news' tile, 'advertisement tile and 'log in' tile should appear on
the right side in that order).

In a velocity template + properties file the template specifies what
properties should be used where.  The template also defines what other
templates to include (as does jsp include).  With the Tiles approach this
'controller' functionality is removed from the template making the template
more reusable.

I don't think so. You could easily write Tiles using velocity, with the velocity directives pulling information from an XML file / database etc. At a raw level, Tiles isn't that complicated (unless I am missing something).


However, the distinction is that you can only have one decorator per
page, rather than lots of 'tiles'.  Mostly this fits with web design, as
usually there is one rather large 'content' area, with some other
navigation around it.

Yeah, this is the key difference. Tiles provides a mechanism to arrange *many* self contained tiles components on a page. This is essential for complex pages (think portal site). For example I can specify a list of tiles to appear in any area of the page in a particular order by using a simple iterator tile. The iterator tile will add each tile in order, one on top of the other.

This is incredibly powerful for page composition.

All Tiles does is provide a simple way to define what reusable tiles you
want on a particular page (tiles-def.xml) making composing pages from
components easy.

But how does this work with Struts / Webwork? If you are using portlets, then you would be best off using the portlets API (if it is ever released). Else how do you have multiple actions in the page?


I've written a custom dispatcher before (allowing multiple actions to run on one page) - but I'll save that for another email.

So - what does Tiles give you? If you have one 'Tile' that is the main page, and the rest are just utilies, then why not use sitemesh.

Alternatively, if you have multiple independent actions in your page, you should be using a portlet approach anyhow.

You could even use Tiles inside your decorator (decorators as just JSP
files) to do this logic.

Great idea. Or use it to compose the 'content' area from many tiles and then decorate that with Sitemesh.

Yep - you can do either thing.


Can you give me some more examples of your usage? I'm yet to see a non-trivial example of using Tiles that makes sense to me.


That's it - the whole page.  The 'jiraform' decorator decorates the form
box, and the normal decorator decorates the whole page.


In your example the form box (a page component) defines what decorator to
use.  This limits its reusability because it is *not* decoupled from its
decorator.  However, I understand that this does not have to be defined
here.

Another question - how do you re-use tiles pages? You can use the same template with different data, but how do you re-use the data in different places? They must depend on the decorator? Ie, depend on being inside a table.


Anyhow - I'd suggest that you look at Sitemesh.  It doesn't do what you
are asking - but I think that Sitemesh and other tools means that you
don't actually want to do that ;)

I certainly will look at using it for the task it was designed for. The two tools have some overlap but the problem they solve is different. Sitemesh can easily enforce a consistent look to a web site by decorating the content pages. Tiles can help compose complex pages by arranging simple components.

I agree completely. Please let me know some more information on how you use Tiles - I've never had to use it, but maybe I should.


Cheers,
Scott

--

ATLASSIAN - http://www.atlassian.com
Expert J2EE Software, Services and Support
-------------------------------------------------------
Need a simple, powerful way to track and manage issues?
Try JIRA - http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to