SpringMVC+EasyUI實(shí)現(xiàn)頁(yè)面左側(cè)導(dǎo)航菜單功能
1. 效果圖展示

2. 工程目錄結(jié)構(gòu)
注意: webapp下的resources目錄放置easyui和js(jQuery文件是另外的)
3. 代碼
index.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>學(xué)生成績(jī)管理系統(tǒng) 管理員后臺(tái)</title>
<link rel="stylesheet" type="text/css" href="/resources/easyui/css/default.css" rel="external nofollow" rel="external nofollow" />
<link rel="stylesheet" type="text/css" href="/resources/easyui/themes/default/easyui.css" rel="external nofollow" rel="external nofollow" >
<link rel="stylesheet" type="text/css" href="/resources/easyui/themes/icon.css" rel="external nofollow" rel="external nofollow" >
<%--以下三個(gè)js文件導(dǎo)入順序不要調(diào)整!!--%>
<script type="text/javascript" src="/resources/js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="/resources/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/resources/easyui/js/outlook2.js"></script>
<script type="text/javascript">
var _menus = {
"menus": [
{
"menuid": "1", "icon": "", "menuname": "成績(jī)統(tǒng)計(jì)分析",
"menus": [
{
"menuid": "11",
"menuname": "考試列表",
"icon": "icon-exam",
"url": "ExamServlet?method=toExamListView"
}
]
},
{
"menuid": "2", "icon": "", "menuname": "學(xué)生信息管理",
"menus": [
{
"menuid": "21",
"menuname": "學(xué)生列表",
"icon": "icon-user-student",
"url": "StudentServlet?method=toStudentListView"
},
]
},
{
"menuid": "3", "icon": "", "menuname": "教師信息管理",
"menus": [
{
"menuid": "31",
"menuname": "教師列表",
"icon": "icon-user-teacher",
"url": "TeacherServlet?method=toTeacherListView"
},
]
},
{
"menuid": "4", "icon": "", "menuname": "基礎(chǔ)信息管理",
"menus": [
{
"menuid": "41",
"menuname": "年級(jí)列表",
"icon": "icon-world",
"url": "GradeServlet?method=toGradeListView"
},
{
"menuid": "42",
"menuname": "班級(jí)列表",
"icon": "icon-house",
"url": "ClazzServlet?method=toClazzListView"
},
{
"menuid": "43",
"menuname": "課程列表",
"icon": "icon-book-open",
"url": "CourseServlet?method=toCourseListView"
}
]
},
{
"menuid": "5", "icon": "", "menuname": "系統(tǒng)管理",
"menus": [
{
"menuid": "51",
"menuname": "系統(tǒng)設(shè)置",
"icon": "icon-set",
"url": "SystemServlet?method=toAdminPersonalView"
},
]
}
]
};
</script>
</head>
<body class="easyui-layout" style="overflow-y: hidden" scroll="no">
<div region="north" split="true" border="false" style="overflow: hidden; height: 30px;
line-height: 20px;color: #fff; font-family: Verdana, 微軟雅黑,黑體"></div>
<div data-options="region:'south',title:'South Title',split:true" style="height:100px;"></div>
<div data-options="region:'west',title:'導(dǎo)航菜單',split:true" style="width:200px;">
<div id="nav" class="easyui-accordion" fit="true" border="false">
</div>
</div>
<div data-options="region:'center',title:'center title'" style="padding:5px;background:#eee;"></div>
</body>
</html>
springmvc.xml配置靜態(tài)資源
<!--靜態(tài)資源--> <mvc:resources mapping="/resources/**" location="/resources/"/>
注意:
1. EasyUI和JQuery文件是放在webapp/resources目錄下的, 需要把 jquery-1.7.2.js也引進(jìn)去.
2. jsp文件中引入EasyUI的css和js文件的順序如下, 不要隨意調(diào)整!!!
<link rel="stylesheet" type="text/css" href="/resources/easyui/css/default.css" rel="external nofollow" rel="external nofollow" /> <link rel="stylesheet" type="text/css" href="/resources/easyui/themes/default/easyui.css" rel="external nofollow" rel="external nofollow" > <link rel="stylesheet" type="text/css" href="/resources/easyui/themes/icon.css" rel="external nofollow" rel="external nofollow" > <%--以下三個(gè)js文件導(dǎo)入順序不要調(diào)整!!--%> <script type="text/javascript" src="/resources/js/jquery-1.7.2.js"></script> <script type="text/javascript" src="/resources/easyui/jquery.easyui.min.js"></script> <script type="text/javascript" src="/resources/easyui/js/outlook2.js"></script>
3. springMVC的靜態(tài)資源配置是針對(duì)resources目錄下所有文件的, 所以之后的圖片等靜態(tài)資源文件也直接放在resources目錄下即可.
4. 導(dǎo)航菜單是在以下id為nav的div里顯示的
<div data-options="region:'west',title:'導(dǎo)航菜單',split:true" style="width:200px;"> <div id="nav" class="easyui-accordion" fit="true" border="false"> </div> </div>
該div的id屬性一定要是 nav, 試過(guò)其它的都沒(méi)有效果.
總結(jié)
以上所述是小編給大家介紹的SpringMVC+EasyUI實(shí)現(xiàn)頁(yè)面左側(cè)導(dǎo)航菜單功能,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!
- layui的數(shù)據(jù)表格+springmvc實(shí)現(xiàn)搜索功能的例子
- 利用SpringMVC和Ajax實(shí)現(xiàn)文件上傳功能
- SpringMVC整合websocket實(shí)現(xiàn)消息推送及觸發(fā)功能
- SpringMVC+Ajax實(shí)現(xiàn)文件批量上傳和下載功能實(shí)例代碼
- SpringMVC實(shí)現(xiàn)表單驗(yàn)證功能詳解
- SpringMVC多個(gè)文件上傳及上傳后立即顯示圖片功能
- Spring MVC+MyBatis+MySQL實(shí)現(xiàn)分頁(yè)功能實(shí)例
- SpringMVC高級(jí)開(kāi)發(fā)功能實(shí)現(xiàn)過(guò)程解析
相關(guān)文章
解析Java的Spring框架的BeanPostProcessor發(fā)布處理器
這篇文章主要介紹了Java的Spring框架的BeanPostProcessor發(fā)布處理器,Spring是Java的SSH三大web開(kāi)發(fā)框架之一,需要的朋友可以參考下2015-12-12
IDEA2023創(chuàng)建MavenWeb項(xiàng)目并搭建Servlet工程的全過(guò)程
Maven提供了大量不同類型的Archetype模板,通過(guò)它們可以幫助用戶快速的創(chuàng)建Java項(xiàng)目,這篇文章主要給大家介紹了關(guān)于IDEA2023創(chuàng)建MavenWeb項(xiàng)目并搭建Servlet工程的相關(guān)資料,需要的朋友可以參考下2023-10-10
SSM框架使用poi導(dǎo)入導(dǎo)出Excel的詳細(xì)方法
這篇文章主要介紹了SSM框架使用poi導(dǎo)入導(dǎo)出Excel,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-03-03
idea項(xiàng)目debug模式啟動(dòng),斷點(diǎn)失效,斷點(diǎn)紅點(diǎn)內(nèi)無(wú)對(duì)勾問(wèn)題及解決
這篇文章主要介紹了idea項(xiàng)目debug模式啟動(dòng),斷點(diǎn)失效,斷點(diǎn)紅點(diǎn)內(nèi)無(wú)對(duì)勾問(wèn)題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-10-10
springboot 如何通過(guò)SpringTemplateEngine渲染html
通過(guò)Spring的Thymeleaf模板引擎可以實(shí)現(xiàn)將模板渲染為HTML字符串,而不是直接輸出到瀏覽器,這樣可以對(duì)渲染后的字符串進(jìn)行其他操作,如保存到文件或進(jìn)一步處理,感興趣的朋友跟隨小編一起看看吧2024-10-10
java 動(dòng)態(tài)增加定時(shí)任務(wù)示例
本篇文章主要介紹了java 動(dòng)態(tài)增加定時(shí)任務(wù)示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-03-03
SpringBoot默認(rèn)包掃描機(jī)制及@ComponentScan指定掃描路徑詳解
這篇文章主要介紹了SpringBoot默認(rèn)包掃描機(jī)制及@ComponentScan指定掃描路徑詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-11-11
解決Spring Cloud中Feign/Ribbon第一次請(qǐng)求失敗的方法
這篇文章主要給大家介紹了關(guān)于解決Spring Cloud中Feign/Ribbon第一次請(qǐng)求失敗的方法,文中給出了三種解決的方法,大家可以根據(jù)需要選擇對(duì)應(yīng)的方法,需要的朋友們下面來(lái)一起看看吧。2017-02-02
java針對(duì)于時(shí)間轉(zhuǎn)換的DateUtils工具類
這篇文章主要為大家詳細(xì)介紹了java針對(duì)于時(shí)間轉(zhuǎn)換的DateUtils工具類,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-12-12
Java數(shù)據(jù)庫(kù)連接_jdbc-odbc橋連接方式(詳解)
下面小編就為大家?guī)?lái)一篇Java數(shù)據(jù)庫(kù)連接_jdbc-odbc橋連接方式(詳解)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-08-08

