In this topic
About the TocControl
The TocControl—or table of contents (TOC) control—displays the contents of a map and allows an end user to turn layers on and off. The TocControl functions in the same manner as the TOC in ArcMap; it presents a hierarchical list of data frames, layers, and symbols displayed on the map.
The TocControl works with the WebToc object, which is the business object that uses the TocFunctionality objects configured with GISResource. The TocRenderer class renders the control to the appropriate markup by generating an Extensible Markup Language (XML) representation of the control using Extensible Style Language Transformations (XSLT) to transform it to the required markup. The TocTag class exposes the control as a JavaServer Pages (JSP) custom tag named toc.
TOC tree
The TOC is made up of a collection of TocNode objects. A TocNode stores content, maintains hierarchical relationships, and responds to an event that occurs at that node. To store content, a TocNode requires a TocNodeContent object to encapsulate the content at that node. See the following diagram:

A TocNode handles its own expand or collapse event and delegates the check box event (for layer visibility) and the node operation (when node content is clicked) to the TocNodeContent’s event handling methods. See the following code example:
public void handleCheckedEvent(TocEvent args)public void handleNodeEvent(TocEvent
args)
Working with the TocControl
The TocRenderer controls how the TocControl is displayed on the page and manages the events for the table of contents. The TocRenderer decodes the following request parameters from the FacesContext:
- tocId + _nodeKey—The key of the node responsible for the operation.
- tocId + _nodeOperation—The operation to be performed (either click or expandCollapse).