You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Java Programmer <jp...@gmail.com> on 2006/11/22 14:07:23 UTC

Tiles & menus

Hello,
I have some troubles with finding examples of using SimpleMenuItem and
<item> tags within <definition>, so far I did menu like this:
- part of tiles-def.xml:
<definition name="aPage" path="/pages/TileExample1.jsp">
        <put name="title"  value="Another Title" />
        <put name="body"   value="aPage.body" />
       	<putList name="menu">
    		<item link="/link1.jsp" value="Link 1" />
    		<item link="/link2.jsp" value="Link 2" />
    		<item link="/link3.jsp" value="Link 3" />
    	</putList>
</definition>
- part of jsp *tile*
<tiles:importAttribute name="menu" />

<c:forEach items="${menu}" var="menuItem">
	<a href="<c:out value="${menuItem.link}" />"><c:out
value="${menuItem.value}" /></a>
</c:forEach>
So first I import attribute into jsp context, and further iterate
through it with jstl forEach / out tags. Is this good solution? Are
there any better for using SimpleMenuItem in JSP pages?

Best regards,
Adr

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Tiles & menus

Posted by "Strachan, Paul" <Pa...@det.nsw.edu.au>.
what is the trouble?...all looks good to me 
 
do you need to include:
  classtype="org.apache.struts.tiles.beans.SimpleMenuItem" ?
 

________________________________

From: Java Programmer [mailto:jprogramista@gmail.com]
Sent: Thu 23/11/2006 12:07 AM
To: user@struts.apache.org
Subject: Tiles & menus



Hello,
I have some troubles with finding examples of using SimpleMenuItem and
<item> tags within <definition>, so far I did menu like this:
- part of tiles-def.xml:
<definition name="aPage" path="/pages/TileExample1.jsp">
        <put name="title"  value="Another Title" />
        <put name="body"   value="aPage.body" />
        <putList name="menu">
                <item link="/link1.jsp" value="Link 1" />
                <item link="/link2.jsp" value="Link 2" />
                <item link="/link3.jsp" value="Link 3" />
        </putList>
</definition>
- part of jsp *tile*
<tiles:importAttribute name="menu" />

<c:forEach items="${menu}" var="menuItem">
        <a href="<c:out value="${menuItem.link}" />"><c:out
value="${menuItem.value}" /></a>
</c:forEach>
So first I import attribute into jsp context, and further iterate
through it with jstl forEach / out tags. Is this good solution? Are
there any better for using SimpleMenuItem in JSP pages?

Best regards,
Adr

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



**********************************************************************
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**********************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org