2009/2/1 Ignacio de Córdoba <[email protected]>:
> You mean a preparer for my path/breadcrums Tile? The preparer whon't have
> information about path as everything related to breadcrums/path depends on
> the Tiles configuration. I so don't figure out what to "prepare" in the
> preparer.

I meant that the code that you posted before, that you can find below,
can easily be written using a preparer for the definition.

The code was:

<tiles:insertDefinition name="breadcrumsTile">
       <tiles:putListAttribute name="breadcrums">
               <jsp:useBean id="item"
class="org.apache.tiles.beans.SimpleMenuItem"
scope="page"/>
                       <c:set var='folderName'><s:property
value="#folderName"/></c:set>
                       <jsp:setProperty  name="item" property="link"
value="Actions_folder.action?folderName=${folderName}"/>
                       <jsp:setProperty name="item" property="value"
value="${folderName}"/>
                       <tiles:addAttribute value="${item}"/>
       </tiles:putListAttribute>
</tiles:insertDefinition>

You can change it into:

<tiles:insertDefinition name="breadcrumsTile" preparer="my.package.MyPreparer">
</tiles:insertDefinition>

And create the "MyPreparer" class that uses the AttributeContext to
fill the list attribute:

ListAttribute listAttribute = new ListAttribute();
List<Attribute> attributes= new ArrayList<Attribute>();
// Code to fill the list
listAttribute.setValue(attributes);
attributeContext.putAttribute("breadcrums", listAttribute);

HTH
Antonio

Reply via email to