LayUi
LayUi入门
把LAYUI MINI 项目引入本项目
把layuimini里的api、css、images、js、li、page
文件夹复制到WEB-INF文件夹下
在WEB-INF/pages里新建index.jsp并把layuimini里的index.html 代码拷贝进来
新建BaseController
在com.gychen.controller文件夹中新建BaseController类
package com.gychen.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class BaseController {
@RequestMapping("/index")
public String index() { return "index"; }
}
添加JSTL和EL依赖(可用来获取路径信息)
javax.servlet
jstl
1.2
taglibs
standard
1.1.2
javax.el
javax.el-api
3.0.0
provided
com.fasterxml.jackson.core
jackson-core
2.10.4
com.fasterxml.jackson.core
jackson-databind
2.10.4
com.github.pagehelper
pagehelper
5.1.2
com.fasterxml.jackson.core
jackson-databind
2.9.5
4.0.0
com.gychen
libraryManagerSystem
1.0-SNAPSHOT
war
libraryManagerSystem Maven Webapp
http://www.example.com
UTF-8
1.8
1.8
5.1.3.RELEASE
1.6.6
1.2.12
8.0.20
3.4.5
org.aspectj
aspectjweaver
1.6.8
org.springframework
spring-aop
${spring.version}
org.springframework
spring-context
${spring.version}
org.springframework
spring-web
${spring.version}
org.springframework
spring-webmvc
${spring.version}
org.springframework
spring-test
${spring.version}
org.springframework
spring-tx
${spring.version}
org.springframework
spring-jdbc
${spring.version}
junit
junit
4.12
compile
mysql
mysql-connector-java
${mysql.version}
javax.servlet
servlet-api
2.5
provided
javax.servlet.jsp
jsp-api
2.0
provided
jstl
jstl
1.2
log4j
log4j
${log4j.version}
org.slf4j
slf4j-api
${slf4j.version}
org.slf4j
slf4j-log4j12
${slf4j.version}
org.mybatis
mybatis
${mybatis.version}
org.mybatis
mybatis-spring
1.3.0
com.mchange
c3p0
0.9.5.2
jar
compile
org.mybatis.generator
mybatis-generator-core
1.3.7
javax.servlet
jstl
1.2
taglibs
standard
1.1.2
javax.el
javax.el-api
3.0.0
provided
com.fasterxml.jackson.core
jackson-core
2.10.4
com.fasterxml.jackson.core
jackson-databind
2.10.4
com.github.pagehelper
pagehelper
5.1.2
com.fasterxml.jackson.core
jackson-databind
2.9.5
libraryManagerSystem
maven-clean-plugin
3.1.0
maven-resources-plugin
3.0.2
maven-compiler-plugin
3.8.0
maven-surefire-plugin
2.22.1
maven-war-plugin
3.2.2
maven-install-plugin
2.5.2
maven-deploy-plugin
2.8.2
org.mybatis.generator
mybatis-generator-maven-plugin
1.3.2
true
true
配置springmvc.xml的静态资源开放权限
引入jstl标签
在WEB-INF/pages/index.jsp里引入jstl标签
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path=request.getContextPath();
String basePath=request.getScheme()+
"://"+request.getServerName()+
":"+request.getServerPort()+path+
"/";
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path=request.getContextPath();
String basePath=request.getScheme()+
"://"+request.getServerName()+
":"+request.getServerPort()+path+
"/";
%>
后台管理系统
启动Tomcat,在浏览器输入 http://localhost:8080/library/index 跳出后台管理静态页面
修改主页左侧的功能导航栏分组
在webapp/api/init.json里更改相关信息
{
"homeInfo": {
"title": "首页",
"href": "page/welcome-1.html?t=1"
},
"logoInfo": {
"title": "图书馆管理",
"image": "images/logo.png",
"href": ""
},
"menuInfo": [
{
"title": "功能管理",
"icon": "fa fa-address-book",
"href": "",
"target": "_self",
"child": [
{
"title": "借阅管理",
"href": "page/table.html",
"icon": "fa fa-flag",
"target": "_self"
},
{
"title": "图书管理",
"href": "page/table.html",
"icon": "fa fa-gears",
"target": "_self"
},
{
"title": "读者管理",
"href": "page/table.html",
"icon": "fa fa-file-text",
"target": "_self"
},
{
"title": "类型管理",
"href": "page/type.html",
"icon": "fa fa-spotify",
"target": "_self"
},
{
"title": "公告管理",
"href": "page/table.html",
"icon": "fa fa-window-maximize",
"target": "_self"
}
]
},
{
"title": "统计分析",
"icon": "fa fa-slideshare",
"href": "",
"target": "_self",
"child": [
{
"title": "图标列表",
"href": "page/icon.html",
"icon": "fa fa-dot-circle-o",
"target": "_self"
},
{
"title": "图标选择",
"href": "page/icon-picker.html",
"icon": "fa fa-adn",
"target": "_self"
},
{
"title": "颜色选择",
"href": "page/color-select.html",
"icon": "fa fa-dashboard",
"target": "_self"
},
{
"title": "下拉选择",
"href": "page/table-select.html",
"icon": "fa fa-angle-double-down",
"target": "_self"
},
{
"title": "文件上传",
"href": "page/upload.html",
"icon": "fa fa-arrow-up",
"target": "_self"
},
{
"title": "富文本编辑器",
"href": "page/editor.html",
"icon": "fa fa-edit",
"target": "_self"
},
{
"title": "省市县区选择器",
"href": "page/area.html",
"icon": "fa fa-rocket",
"target": "_self"
}
]
},
{
"title": "其它管理",
"icon": "fa fa-slideshare",
"href": "",
"target": "_self",
"child": [
{
"title": "多级菜单",
"href": "",
"icon": "fa fa-meetup",
"target": "",
"child": [
{
"title": "按钮1",
"href": "page/button.html?v=1",
"icon": "fa fa-calendar",
"target": "_self",
"child": [
{
"title": "按钮2",
"href": "page/button.html?v=2",
"icon": "fa fa-snowflake-o",
"target": "_self",
"child": [
{
"title": "按钮3",
"href": "page/button.html?v=3",
"icon": "fa fa-snowflake-o",
"target": "_self"
},
{
"title": "表单4",
"href": "page/form.html?v=1",
"icon": "fa fa-calendar",
"target": "_self"
}
]
}
]
}
]
},
{
"title": "失效菜单",
"href": "page/error.html",
"icon": "fa fa-superpowers",
"target": "_self"
}
]
}
]
}