struts2里面使用 tree标签 需要导入包:struts2-dojo-plugin-2.1.8.1.jar
然后 tree.jsp 页面:
a. 引入标签库
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
b. 需要在<head></head>内加入:
<sx:head parseContent="true"/>
c. 使用tree标签:<sx:tree />
代码:
<sx:tree label="图书" id="book" showRootGrid="true" showGrid="true" treeSelectedTopic="treeSelected">
<sx:treenode label="李" id="yeeku">
<sx:treenode label="<a href='listUser' target='_blank'>Spring2.0</a>" id="spring">
<sx:treenode label="JSP" id="lightweight"/>
</sx:treenode>
<sx:treenode label="J2EE" id="lightweight"/>
<sx:treenode label="Ajax" id="ajax"/>
</sx:treenode>
<sx:treenode label="David" id="David">
<sx:treenode label="JavaScript: The Definitive Guide" id="javascript"/>
</sx:treenode>
<sx:treenode label="Johnson" id="Johnson">
<sx:treenode label="Expert One-on-One J2EE Design and Development" id="j2ee"/>
</sx:treenode>
</sx:tree>
效果: