基于springboot框架的前后台数据交互显示
主要实现在前台html页面对数据库进行增删改的操作,通过在前台修改用户的信息,保存到后台数据库,同时,将更新后的信息从数据库进行读取。
今天这篇博客是对我前面的一个信息修改功能进行完善。代码相对前面的一篇博客更加简洁。
项目目录结构图如下所示。
1 前台html页面代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" xmlns:float="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8"/>
<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css"/>
<link rel="stylesheet" type="text/css" href="easyui/demo/demo.css"/>
<script type="text/javascript" src="easyui/jquery.min.js"></script>
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="easyui/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="js1/manageruser.js"></script>
</head>
<body>
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'north'" style="width: 100%;height: 9%">
</div>
<div data-options="region:'center',title:'用户列表'">
<table id="datagrid" class="easyui-datagrid" style="width:100%;height:100%"
url="/stuinforlist"
toolbar="#dgtoolbar" pagination="true"
pageSize="25" pageList="[25,15,10]"
rownumbers="false" fitColumns="true" singleSelect="true" >
<thead>
<tr>
<th data-options="field:'sno',align:'center',width:'9%'">工号</th>
<th data-options="field:'sname',align:'center',width:'9%'">姓名</th>
<th data-options="field:'password',align:'center',width:'9%'">密码</th>
<th data-options="field:'tno',align:'center',width:'11%'">课程号</th>
<th data-options="field:'tname',align:'center',width:'9%'">课程名</th>
<th data-options="field:'tgrade',align:'center',width:'9%'">成绩</th>
</tr>
</thead>
</table>
<div id="dgtoolbar">
<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUsers()">添加用户</a>
<a href="#" class="easyui-linkbutton" iconCls="icon-cut" plain="true" onclick="removeUsers()">删除用户</a>
<a href="#" class="easyui-l