2010/2/9 Mck <[email protected]>:
>    <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" cascade="true"/>
>    </definition>
>    <definition name="vertical.motor" template="/WEB-INF/blank.jsp">
>        <put-attribute name="description" 
> value="/WEB-INF/tiles/vertical/motor/description.jsp" cascade="true"/>
>    </definition>

Another try, but this time it involves a bit of hacking and exposing
some Tiles internals.
Associate a preparer to vertical.motor that accesses to the stack of
AttributeContext's:

 ArrayStack<AttributeContext> contextStack =
            (ArrayStack<AttributeContext>) tilesContext
                .getRequestScope().get(ATTRIBUTE_CONTEXT_STACK);

Where ATTRIBUTE_CONTEXT_STACK has this value:
"org.apache.tiles.AttributeContext.STACK"

Get the element under the top of the stack, that it is the attribute
context of the parent definition (probably, it might be 2 under the
top, not sure) and transfer the attribute that is under the current
AttributeContext (parameter in the preparer).
Finally, in your template page do:

>  <tiles:insertDefinition name="vertical.motor" preparer="my.Preparer"/>
>  <tiles:insertAttribute name="description"/>

You can also associate the preparer in the tiles.xml file if you like.

Does it sound better? :-D

Ciao
Antonio

Reply via email to