当前位置: 代码迷 >> J2EE >> JavaEE框架 树状结构菜单的跳转(<sx:tree>),该如何处理
  详细解决方案

JavaEE框架 树状结构菜单的跳转(<sx:tree>),该如何处理

热度:172   发布时间:2016-04-22 01:02:28.0
JavaEE框架 树状结构菜单的跳转(<sx:tree>)
Java code
<%@page language="java" import="java.util.*" pageEncoding="utf-8"%><%@page import="javax.swing.JFrame" %><%@taglib prefix="s" uri="/struts-tags"%><%@taglib prefix="sx" uri="/struts-dojo-tags"%><%    String path = request.getContextPath();    String basePath = request.getScheme() + "://"            + request.getServerName() + ":" + request.getServerPort()            + path + "/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>    <head>        <base href="<%=basePath%>">        <title>操作列表</title>        <meta http-equiv="pragma" content="no-cache">        <meta http-equiv="cache-control" content="no-cache">        <meta http-equiv="expires" content="0">        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">        <meta http-equiv="description" content="This is my page">        <sx:head parseContent="true"/>         <link rel="stylesheet" type="text/css" href="css/common.css">        <script type="text/javascript" language="javascript" charset="utf-8">         dojo.event.topic.subscribe("treeSelected",function treeNodeSelected(source){           dojo.io.bind({            url: "admin/student/"+source.widgetId+".jsp",            load: function(type, data, evt) {                  var src = evt.target;                  alert(src.nodeName);            },            mimeType: "text/html"        });        });        </script>    </head>    <body style="background: url(images/bg.png)">        <sx:tree label="管理系统" id="root" rootNode="管理系统 "  treeSelectedTopic="treeSelected">            <sx:treenode label="考生信息管理">                <sx:treenode label="添加考生" id="addStu"/>                <sx:treenode label="考生信息修改" id="modStu"/>            </sx:treenode>            <sx:treenode label="题库管理">                <sx:treenode label="添加试题"/>                <sx:treenode label="删除试题" />                <sx:treenode label="修改试题" />            </sx:treenode>            <sx:treenode label="试卷管理">                <sx:treenode label="删除试卷" />                <sx:treenode label="生成试卷" />            </sx:treenode>            <sx:treenode label="考试安排">                <sx:treenode label="" />                <sx:treenode label="" />            </sx:treenode>            <sx:treenode label="成绩查询">                <sx:treenode label="" />                <sx:treenode label="" />            </sx:treenode>        </sx:tree>    </body>    <script type="text/javascript">       window.onload=function(){        var nodes =dojo.widget.manager.getWidgetsByType('struts:StrutsTreeNode');        for( var i=0; i < nodes.length; i++){               nodes[i].expand();           }        }    </script></html>

上面是struts框架的一个树状菜单,问题是我想点击的时候它在一个指定的<iframe>中显示我想要的页面,现在不知道怎么办?dojo是必须用的吗?以前的javascript咋都不行了,求解决!主要是讲讲为什么用dojo,不用不行吗?
Java code
<html>    <head>        <base href="<%=basePath%>">        <title>管理员主界面</title>        <meta http-equiv="pragma" content="no-cache">        <meta http-equiv="cache-control" content="no-cache">        <meta http-equiv="expires" content="0">        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">        <meta http-equiv="description" content="This is my page">        <link rel="stylesheet" type="text/css" href="css/main_admin.css" />        <script language="javascript" src="js/common.js" charset="utf-8"></script>    </head>    <body>        <div id="wrap">            <div id="head" style="background-color: purple; margin-top: -15px;">                <div id="head1">                    <span style="font-weight: bold; font-size: 35px;"> 在线考试系统 </span>                    <span id="navigation" style="margin-left: 800px;"> <a                        href="javascript:void(0)" onclick="loginOut('Admin')">退出系统</a> <a href="#">使用帮助</a> <a href="#">返回首页</a> </span>                </div>                <div id="head2" style="margin-top: 25px;">                    <span style="clear: both; margin-left: 1050px;">今天是:<script>getCurrentTime()</script> </span>                </div>                <div id="head3" style="background-color: gray;">                    您好:                </div>            </div>            <div id="content">                <table width="100%" height="100%">                    <tr>                        <td width="20%" height="100%">                            <iframe src="admin/leftList.jsp" scrolling="no" frameborder="0"                                id="leftList" height="100%" width="100%"></iframe>                        </td>                        <td style="background-color: gray;">                        </td>                        <td width="79%" height="100%">            <!--在此iframe中显示-->                            <iframe src="admin/welcome.jsp" scrolling="auto" frameborder="0"                                width="100%" height="100%" id="main" name="main"></iframe>                        </td>                    </tr>                </table>            </div>            <div id="footer">                <jsp:include page="/commons/footer.jsp"></jsp:include>            </div>        </div>    </body></html>
  相关解决方案