You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Struts Newsgroup (@Basebeans.com)" <st...@basebeans.com> on 2002/03/22 22:25:01 UTC

Tiles question: Is it possible to insert a ComponentDefinition into a Tile context dynamically?

Subject: Tiles question: Is it possible to insert a ComponentDefinition into a Tile context dynamically?
From: "Chris Cool" <Ch...@openpages.com>
 ===
Hi,

I have a tile that reads items from a PutList list and then inserts each
item into the current page.

<struts_logic:iterate id="item" name="itemList" scope="page" type="String">

<tiles:insert name='<%=item%>' flush="true"/>

</struts_logic:iterate>

When the items in the list are tiles defined in my tileDefinitions.xml file,
the tiles are inserted into my JSP correctly. However, I want to dynamically
create a tile definition and insert it into the page context.

I am generating the ComponentDefinition in my tile controller and accessing
the "itemList" where I add the name of the dynamically generated definition:

/* get the item list and insert new tile def into it */

ArrayList itemList = (ArrayList)context.getAttribute("itemList");

if (itemList != null) {

HashMap map = new HashMap();

map.put("name", "newtarget");

map.put("link", "newtarget.do");


ComponentDefinition newItem =

new ComponentDefinition("new.item",

"/mytiles/simpleItem.jsp",

map);

DefinitionsUtil.setActionDefinition( request, breadCrumbItem );

itemList.add("new.item");

}

In my tile, the "itemList" contains the "new.item" entry, but it does not
appear to find the ComponentDefinition I created.

Thanks for you help.

Chris



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>