Springboot基于thymeleaf的一个简单的学生管理系统
项目介绍:
这个项目是基于springboot+thymeleaf+mysql的一个学生管理项目,是几年前学习时期跟着狂神敲的一个简单的增删改查的小项目,如果对源码感兴趣的小伙伴可以留言。
项目结构:
登陆页面:
首页:
添加页面:
部分代码:
package com.lili.springboot.controller;import com.lili.springboot.entity.Admin;
import com.lili.springboot.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpSession;/*** @author: QiJingJing* @create: 2020-05-21 07:56**/
@Controller
public class AdminController {@Autowiredprivate AdminService adminService;@GetMapping("/findUser")public String findUser(Admin admin, Model model, HttpSession session){Admin user = adminService.getUser(admin);if(user!=null){session.setAttribute("username",user.getUsername());return "redirect:/main.html";}else{model.addAttribute("msg","用户名或密码错误!");return "index";}}@GetMapping("/logout")public String logout(HttpSession session){session.invalidate();return "redirect:/index.html";}
}
<!DOCTYPE html>
<!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
<html lang="en"xmlns:th="http://www.thymeleaf.org"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="description" content=""><meta name="author" content=""><title>Dashboard Template for Bootstrap</title><!-- Bootstrap core CSS --><link th:href="@{/asserts/css/bootstrap.min.css}" rel="stylesheet"><!-- Custom styles for this template --><link th:href="@{/asserts/css/dashboard.css}" rel="stylesheet"><style type="text/css">/* Chart.js */@-webkit-keyframes chartjs-render-animation {from {opacity: 0.99}to {opacity: 1}}@keyframes chartjs-render-animation {from {opacity: 0.99}to {opacity: 1}}.chartjs-render-monitor {-webkit-animation: chartjs-render-animation 0.001s;animation: chartjs-render-animation 0.001s;}</style></head><body><div th:replace="~{commons/commons::topbar}"></div><div class="container-fluid"><div class="row"><div th:replace="~{commons/commons::sidebar(active='list.html')}"></div><div class="sidebar-sticky"><ul class="nav flex-column"><li class="nav-item"><a class="nav-link active" href="#"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>Dashboard <span class="sr-only">(current)</span></a></li><li class="nav-item"><a class="nav-link" href="#"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file"><path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline></svg>Orders</a></li><li class="nav-item"><a class="nav-link" href="#"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-cart"><circle cx="9" cy="21" r="1"></circle><circle cx="20" cy="21" r="1"></circle><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path></svg>Products</a></li><li class="nav-item"><a class="nav-link" th:href="@{/findStudent}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-users"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>员工列表</a></li><li class="nav-item"><a class="nav-link" href="#"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bar-chart-2"><line x1="18" y1="20" x2="18" y2="10"></line><line x1="12" y1="20" x2="12" y2="4"></line><line x1="6" y1="20" x2="6" y2="14"></line></svg>Reports</a></li><li class="nav-item"><a class="nav-link" href="#"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-layers"><polygon points="12 2 2 7 12 12 22 7 12 2"></polygon><polyline points="2 17 12 22 22 17"></polyline><polyline points="2 12 12 17 22 12"></polyline></svg>Integrations</a></li></ul><h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted"><span>Saved reports</span><a class="d-flex align-items-center text-muted" href="#"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line></svg></a></h6><ul class="nav flex-column mb-2"><li class="nav-item"><a class="nav-link" href="#"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>Current month</a></li><li class="nav-item"><a class="nav-link" href="#"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>Last quarter</a></li><li class="nav-item"><a class="nav-link" href="#"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>Social engagement</a></li><li class="nav-item"><a class="nav-link" href="#"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>Year-end sale</a></li></ul></div></nav><main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4"><h2><a th:href="@{/add}" class="btn btn-sm btn-success">添加学生</a></h2><div class="table-responsive"><table class="table table-striped table-sm"><thead><tr><th>学号</th><th>姓名</th><th>性别</th><th>民族</th><th>出生日期</th><th>家庭地址</th><th>身份证号</th><th>操作</th></tr></thead><tbody><tr th:each="ms:${msg}"><td th:text="${ms.getStudentId()}"></td><td th:text="${ms.getStudentName()}"></td><td th:text="${ms.getSex()}"></td><td th:text="${ms.getGroup()}"></td><td th:text="${#dates.format(ms.getBornDate(),'yyyy-MM-dd')}"></td><td th:text="${ms.getAddress()}"></td><td th:text="${ms.getIdNumber()}"></td><td><a class="btn btn-sm btn-primary" th:href="@{'/toUpdateStudent/'+${ms.getId()}}">编辑</a><a class="btn btn-sm btn-danger" th:href="@{'/delete/'+${ms.getId()}}">删除</a></td></tr></tbody></table></div></main></div></div><!-- Bootstrap core JavaScript================================================== --><!-- Placed at the end of the document so the pages load faster --><script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js"></script><script type="text/javascript" src="asserts/js/popper.min.js"></script><script type="text/javascript" src="asserts/js/bootstrap.min.js"></script><!-- Icons --><script type="text/javascript" src="asserts/js/feather.min.js"></script><script>feather.replace()</script><!-- Graphs --><script type="text/javascript" src="asserts/js/Chart.min.js"></script><script>var ctx = document.getElementById("myChart");var myChart = new Chart(ctx, {type: 'line',data: {labels: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],datasets: [{data: [15339, 21345, 18483, 24003, 23489, 24092, 12034],lineTension: 0,backgroundColor: 'transparent',borderColor: '#007bff',borderWidth: 4,pointBackgroundColor: '#007bff'}]},options: {scales: {yAxes: [{ticks: {beginAtZero: false}}]},legend: {display: false,}}});</script></body>
</html>
Springboot基于thymeleaf的一个简单的学生管理系统相关推荐
- python小项目实例流程-Python小项目:快速开发出一个简单的学生管理系统
原标题:Python小项目:快速开发出一个简单的学生管理系统 本文根据实际项目中的一部分api 设计抽象出来,实例化成一个简单小例子,暂且叫作「学生管理系统」. 这个系统主要完成下面增删改查的功能: ...
- python小项目案例-Python小项目:快速开发出一个简单的学生管理系统
本文根据实际项目中的一部分api 设计抽象出来,实例化成一个简单小例子,暂且叫作「学生管理系统」. 这个系统主要完成下面增删改查的功能: 包括: 学校信息的管理 教师信息的管理 学生信息的管理 根据A ...
- python项目开发实例-Python小项目:快速开发出一个简单的学生管理系统
本文根据实际项目中的一部分api 设计抽象出来,实例化成一个简单小例子,暂且叫作「学生管理系统」. 这个系统主要完成下面增删改查的功能: 包括: 学校信息的管理 教师信息的管理 学生信息的管理 根据A ...
- Android——一个简单的学生管理系统
一个简单的学生管理系统 效果演示 实现功能总览 代码 效果演示 随手做的一个小玩意,还有很多功能没有完善,倘有疏漏,万望海涵. 实现功能总览 实现了登录.注册.忘记密码.成绩查询.考勤情况.课表查看. ...
- springboot+mybatis+thymeleaf学习一个简单的管理系统
在淘宝上买的课程的一个例子,看了视频,抄了一遍代码,那时候刚开始学springboot,所以感觉没什么用,然后就又学习了一段时间.最近回想起来有这样的一个系统符合我现阶段的学习程度,然后就又写了一遍. ...
- python简单项目-Python小项目:快速开发出一个简单的学生管理系统
本文根据实际项目中的一部分api 设计抽象出来,实例化成一个简单小例子,暂且叫作「学生管理系统」. 这个系统主要完成下面增删改查的功能: 包括: 学校信息的管理 教师信息的管理 学生信息的管理 根据A ...
- xml解析案例:一个简单的学生管理系统
1.创建一个xml文件,写一些学生信息 <?xml version="1.0" encoding="UTF-8"?><person> & ...
- 面向对象写一个简单的学生管理系统
package com.xuesheng; //使用面向对象编写一个学生管理系统. //1.学生类属性有:姓名.性别.年龄.班级:学生可以自由选科: //3.在测试类中实例化学生对象,并打印每个学生选 ...
- 用python编写学生管理系统_用python写一个简单的学生管理系统
要求如下:1.一个循环2中输入内容的能力.显示函数添加新名片显示所有查询的名片3退出系统.让用户输入所需的操作,如输入1,2,3,04.新列表提示用户输入名称和输入电子邮件提示成功添加新名片.5.显示 ...
- jquery mysql jsp_jsp+jquery+mysql实现的一个简单的学生管理系统
1 2 3 4 5 6 pageEncoding="utf-8"%> 7 8 9 10 学生管理系统 11 12 href="https://stackpath.b ...
最新文章
- bootstraptable 列隐藏_bootstrapTable 隐藏某一列
- HttpClient 大量连接等待异常的处理
- DOM加载过程中ready和load的区别
- docker安装nginx容器小记
- Android 照相功能
- mysql conflict语句_详细解读MySQL事务
- 将CSV文件存为HTML文件形式
- win7打开chm文件问题解决之道
- 在 Windows 上安装Rabbit MQ 指南
- 论文精读—XGBoost paper
- 怎样解决CMD命令行窗口中文乱码问题
- BZOJ 1106: [POI2007]立方体大作战tet
- 博奥智源汇总关于校车管理系统开发功能列表-转自博奥智源
- 从 .NET 开发人员的角度理解 Excel 对象模型--------结合上一篇 vb code excel 单元格锁定...
- Pycharm下载MaxCompute过程
- java字符串转biginteger_java-将十六进制转换为BigInteger
- AI探索太阳系:从检测月球巨石,到挑战火星“恐怖七分钟”
- 喜讯|宏时数据获得CMMI3级认证!欢迎了解自研统一运维监控平台!
- 用户输入自己的【姓名 年龄 爱好】 + 加CP【姓名 年龄 爱好】,点击按钮,页面显示该用户的信息 点击提交按钮,JSON显示用户信息+副本信息(副本初始值是{})
- 节点表征学习[GCN、GAT]