tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mck <m...@wever.org>
Subject Re: howto delegate to other definitions ?
Date Tue, 09 Feb 2010 19:49:46 GMT
> >    <definition name="WILDCARD:*.*" extends="{1}" template="/WEB-INF/tiles/templates/{2}_template.jsp">

> >        <put-attribute name="vertical" value="vertical.{2}" cascade="true" type="definition"/>

> >        <put-attribute name="body" value="/WEB-INF/tiles/vertical/{2}/content_new.jsp"
> >    </definition> 
> >    <definition name="vertical.motor" template="/WEB-INF/blank.jsp"> 
> >        <put-attribute name="description" value="/WEB-INF/tiles/vertical/motor/description.jsp"
> >    </definition> 
> > 
> > The explicit definition i use here is "advert.motor.car" 
> And why not defining such an explicit definition directly? It seems 
> the best option to me.

1) because of the overwhelming verbosity, and
2) the need to "lock-down" the core hierarchy of definitions,
3) migration of a legacy application where "organisation-and-tidy"
weighs heavier than the "ideal-solution-to-begin-with".

The core hierarchy
   "WILDCARD:*.*.*" --> "WILDCARD:*.*" --> "WILDCARD:*"

along with the fallback syntax "[{3}|{2}|{1}]" gives a solution that
most pages can use without modification to any of the definitions.

It's a pluggable-solution, just drop a custom jsp into the car/ folder.

For example given the following jsps exist used to generate a general
"advert.motor" page:

And one of the developers, that doesn't have permission to edit the core
tiles.xml file, wants to build a "advert.motor.truck" page. All they
have to do is provide the overriding jsps:
and they have the page up and running.

But then say, they wish to do more tiling inside content.jsp, a typical
use-case for a nested definition. The developer doesn't have permission
to edit the core tiles.xml, and putting a specific trunk attribute into
the "WILDCARD:*.*.*" would just be messy for all the other developers
not caring about trucks, so the sideways-delegation is introduced. Here
they can just add, into their own private tiles-motor.xml, the
"subvertical.truck" definition and the attributes that will be used
inside .../trunk/content.jsp

All-in-all this keeps developers out of the definition files as long as
possible, and even then keeps them in their own private definition file.
The alternative forces huge verbosity and duplication between teams of
developers, with no doubt frequent edits on definitions.

Make sense?


We are born naked, wet and hungry. Then things get worse. 
| semb.wever.org | sesat.no | finn.no |

View raw message