Hi all,

I am trying to insert items from a putList defined in my tiles.xml file in a template file. The only way that I can seem to do it is by using the following process

1. make the putList 'List' accessible on the page with <tiles:useAttribute name="myPutList" />
2. sending that variable in to a JSTL Core taglib forEach loop
3. using <tiles:insertDefinition name="${putListItem}" />

I know I'm new to struts 2 and using putLists, but it seems like there's should be a better approach to accessing the items from a putList defined in a tiles.xml file.

What's the best practice for pulling values out of a putList (preferably with the struts:iterator tag, if a loop is required)?

Thanks for the help,

Eric Rank


Here's some specific code for reference:

=======================================
tiles.xml
=======================================

<definition name="myTemplate"  template="myTemplate.jsp">
 <putList name="myPutList">
        <add value="aPreviouslyDefinedDefinition" />
        <add value="bPreviouslyDefinedDefinition" />
        <add value="cPreviouslyDefinedDefinition" />
 </putList>
</definition>


=======================================
myTemplate.jsp -- code that works, but requiring JSTL scares me
=======================================
<tiles:useAttribute name="myPutList" />
<c:forEach items="${myPutList}" var="item">
        <tiles:insertDefinition name="${item}" />
</c:forEach>
        
=======================================
myTemplate.jsp -- code that doesn't work
=======================================
<tiles:useAttribute name="myPutList" />
<s:iterator value="%{myPutList}" id="item">
        <tiles:insertDefinition name="${item}" />
</s:iterator>

=======================================
myTemplate.jsp -- more code that doesn't work
=======================================
<tiles:attribute name="myPutList" />


        



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to