The tabs layout requires a list of beans of class "Item".
In the xml file, you write something like:
<definition name="examples.tabs.body" path="/layouts/tabsLayout.jsp" >
<put name="selectedIndex" value="0" />
<put name="parameterName" value="selected" />
<putList name="tabList" >
<item value="Doc Home" link="/index.jsp" />
<item value="Quick overview" link="/doc/quickOverview.jsp" />
...
</putList>
</definition>
In a jsp page, you should provide a list of item, but the <item> tags doesn't exist. What you can do is to add this tag for your purpose.
Another solution is to initialize the list by creating yourself the beans:
Create a class extending org.apache.struts.tiles.beans.SimpleMenuItem, and providing a constructor with needed parameter (link, value, icon, ...).
Then, create directly objects of this class and add them to the list
<tiles:putList name="tabList" >
<tiles:add value="<%= new your.class.SimpleMenuItem("Doc Home", "/index.jsp" ) %>" />
<tiles:add value="<%= new your.class.SimpleMenuItem("Quick overview", "/doc/quickOverview.jsp" ) %>" />
...
</tiles:putList>
I have never tested this approach, so, maybe it doesn't work.
The simplest is to use an xml config file ;-).
Cedric
Wendy Smoak wrote:
Having successfully mastered vboxLayout and classicLayout, I'm trying to
learn about tabsLayout now. The only examples I can find in the
tiles-documentation webapp are done by configuring the contents of the tabs
in the tiles-examples-defs.xml file. I'm not quite ready for that yet.
I tried this:
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
<tiles:insert page="WEB-INF\jsp\tabsLayout.jsp" flush="true" >
<tiles:put name="selectedIndex" value="0" />
<tiles:put name="parameterName" value="selected" />
<tiles:putList name="tabList" >
<tiles:add name="Three" value="three.jsp" />
<tiles:add name="Four" value="four.jsp" />
</tiles:putList>
</tiles:insert>
but the <tiles:add> tag does not take a 'name' attribute. Can the tabbed
layout only be set up through the XML file, or have I missed something?
I tried removing the 'name' attributes, and ended up with:
[ServletException in:WEB-INF\jsp\tabsLayout.jsp] java.lang.String'
I think I've run into the part of tiles that requires Struts, as I did have
to add the struts.jar file to this webapp in order to get that far.
So... does anyone have a small example of using a tabbed layout in a jsp, or
must it be done with an xml file? I'm off to see if I can figure that out
next.
Thanks,
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

