Hi,

I have an issue with Struts Tiles putList items. I can get all the items in
my jsp page fine, with the links and values for each menu item.

The problem is, when I try to nest a putList tag within another one, to
attempt to create subMenu functionality. I have no way of retrieving the
submenu items on my jsp page.

For example, I have a tile definition called ".mainMenu", which defines a
putList tag with 3 items. The first two are plain <item link="
http://www.google.com"; value="Google Home Page"/> type of items - the third
is not an item, but rather another putList:

<definition name=".mainMenu" path="/WEB-INF/template/header.jsp">
       <putList name="menuItems">
           <item link="http://www.google.com"; value="Google Home Page"/>
           <item link="http://www.gmail.com"; value="Google Email Page"/>
           <putList name="subMenu">
                      <item link="http://somesublink.menu/";
value="SubLinkTest"/>
                      <item link="http://somesublink2.menu/";
value="SubLinkTest2"/>
           </putList>
   </definition>


The point of doing this is obvious - I want to get the subMenu functionality
from the tiles menu items putList tag. However, when displaying it on the
jsp page, I don't know how to iterate over the submenu:

For the main menu:

<tiles:importAttribute name="menuItems" ignore="true"/>

                   <!-- Menu begin -->
                   <ul >
                       <c:forEach var="item" items="${menuItems}">
                           <li><a href="<c:out value="${item.link}"/>"><c:out
value="${item.value}"/></a></li>
                       </c:forEach>
                   </ul>

That works fine for those menuitems in the "top-level" menuItems putList.
When it comes to the other subMenu, I will get errors. Obviously so. The
problem is that when I try to iterate over them with either c:forEach or
using Struts logic:iterate tags I can't do it and get errors as well. What
is interesting is that when I just output the "item" itself, I can see the
entire collection of submenu items -
for example:

<c:out value="${item}"/>

(without any ".value" or ".link") - so I know it is there and is accesible.
The question is, how do I access this putList in the jsp page?

Thanks for your help!!!

-EC

Reply via email to