六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 110|回复: 0

struts2实现树状结构

[复制链接]

升级  92.67%

51

主题

51

主题

51

主题

秀才

Rank: 2

积分
189
 楼主| 发表于 2013-2-7 19:58:28 | 显示全部楼层 |阅读模式
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="GBK"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Struts 2 AJAX - Tree</title>
<s:head theme="ajax" debug="true" />
        <script type="text/javascript">
            function treeNodeSelected(arg) {
                alert(arg.source.title + ' selected');
            }
            dojo.addOnLoad(function() {               
                var s = dojo.widget.byId('parentId').selector;               
                dojo.event.connect(s, 'select', 'treeNodeSelected');
            });
        </script>

</head>
<body>
<h2>树状的实现(Tree)</h2>
<div style="float:left; margin-right: 50px;">
<s:tree label="父接点" id="parentId" theme="ajax"  showRootGrid="true">
<s:treenode theme="ajax" label="子接点1" id="child1Id">
<s:treenode theme="ajax" label="孙子接点1" id="grandchild1Id"></s:treenode>
<s:treenode theme="ajax" label="孙子接点2" id="grandchild2Id"></s:treenode>
<s:treenode theme="ajax" label="孙子接点3" id="grandchild3Id"></s:treenode>
</s:treenode>
<s:treenode theme="ajax" label="子接点2" id="child2Id"></s:treenode>
<s:treenode theme="ajax" label="子接点3" id="child3Id"></s:treenode>
<s:treenode theme="ajax" label="子接点4" id="child4Id"></s:treenode>
<s:treenode theme="ajax" label="子接点5" id="child5Id">
<s:treenode theme="ajax" label="孙接点1" id="gchild1Id"></s:treenode>
<s:treenode theme="ajax" label="孙接点2" id="gchild2Id"></s:treenode>
<s:treenode theme="ajax" label="孙接点3" id="gchild3Id"></s:treenode>
</s:treenode>
</s:tree>

</div>
</body>
</html>
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表