The <tc:treeCommand/> tag can be added to a <tc:treeNode/> tag. The command can be used to execute an action or a link.
<tc:treeCommand/>
<tc:treeNode/>
Tag Library Documentation
In this example, the nodes with children are displayed as <tc:treeLabel/>. The leafs are <tc:treeCommand/>. Like the parent nodes suggest, the entries in 'Actions' run an action with the action attribute. And the entries in 'Links' are links to an external website using the link attribute.
<tc:treeLabel/>
action
link
<?xml version="1.0" encoding="UTF-8"?> <!-- * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. --> <ui:composition template="/main.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:tc="http://myfaces.apache.org/tobago/component" xmlns:ui="http://java.sun.com/jsf/facelets"> <ui:param name="title" value="#{demoBundle.tree_command_types} <tc:treeCommand>"/> <p>The <code class="language-markup"><tc:treeCommand/></code> tag can be added to a <code class="language-markup"><tc:treeNode/></code> tag. The command can be used to execute an action or a link.</p> <p><tc:link label="Tag Library Documentation" image="#{request.contextPath}/image/feather-leaf.png" link="#{demoBundle.tagDocUrl}/#{apiController.currentRelease}/tld/tc/treeCommand.html"/></p> <tc:section label="Example"> <p>In this example, the nodes with children are displayed as <code class="language-markup"><tc:treeLabel/></code>. The leafs are <code class="language-markup"><tc:treeCommand/></code>. Like the parent nodes suggest, the entries in 'Actions' run an action with the <code>action</code> attribute. And the entries in 'Links' are links to an external website using the <code>link</code> attribute.</p> <tc:tree value="#{treeCommandTypesController.sample}" var="node"> <tc:treeNode> <tc:treeIndent showJunctions="false"/> <tc:treeLabel value="#{node.name}" rendered="#{node.childCount > 0}"/> <tc:treeCommand label="#{node.name}" rendered="#{node.childCount == 0}" action="#{treeCommandTypesController.increaseActionCount(node.action)}" link="#{node.url}"/> </tc:treeNode> </tc:tree> <tc:out label="Action 1 Count" value="#{treeCommandTypesController.actionOneCount}"/> <tc:out label="Action 2 Count" value="#{treeCommandTypesController.actionTwoCount}"/> </tc:section> </ui:composition>