Use of the styleClass attribute
Open and close node
Javascript
The styleClass attribute is used to set the css class of the TD and A elements of a node. The TD element contains the name of the node, and the A element the link associated to the node. Be careful that unless explicity not asked to (see the autoIncrement attribute), stuts-layout automatically adds an integer specifying the depth of the node at the end of the styleClass.
<layout:treeview styleClass="TREEVIEWCLASS"/>
will generate something like this for items of depth 1
<td class="TREEVIEWCLASS1">Item 1 name</td> <td class="TREEVIEWCLASS1">Item 2 name</td>
Items of depth 2 will have:
<td class="TREEVIEWCLASS2">Subitem 1 name</td> <td class="TREEVIEWCLASS2">Subitem 2 name</td>
If there is a link for the item, you'll have something like this:
<td class="TREEVIEWCLASS1"><a href="some url" class="TREEVIEWCLASS1">Item 1 name</a></td> <td class="TREEVIEWCLASS1"><a href="some url 2" class="TREEVIEWCLASS1">Item 2 name</a></td>
and for sub nodes:
<td class="TREEVIEWCLASS2"><a href="some url 3" class="TREEVIEWCLASS2">Subitem 1 name</a></td> <td class="TREEVIEWCLASS2"><a href="some url 4" class="TREEVIEWCLASS2">Subitem 2 name</a></td>
Your page is probably missing the treeview javascript code. To include this code, you need to put a <layout:html> or <layout:skin includeScript="true"> in the page.
Example :
<html> <%@ taglib uri="http://struts.improve-technologies.com/layout" prefix="layout" %> <head> <layout:skin includeScript="true"/> ... </head> <body> ... <layout:treeview .../> ... </body> </html>