没有合适的资源?快使用搜索试试~ 我知道了~
实验11 Spring MVC框架:SSM框架整合.docx
需积分: 0 0 下载量 111 浏览量
2023-12-21
17:58:01
上传
评论
收藏 43KB DOCX 举报
温馨提示
试读
17页
实验11 Spring MVC框架:SSM框架整合.docx
资源推荐
资源详情
资源评论
1
实验 11 Spring MVC 框架:SSM 框架整合
【实验目的及要求】
1. 掌握 SSM 框架整合方法;
2. 完成成绩管理系统的课程管理模块;
3. 基于 SSM 框架的系统设计方法;
4. 要求所有回答的文本格式:五号,宋体、1.5 倍行距,保留段单元格背
景。
【实验步骤】
1、基于配置文件的 SSM 框架整合(学生信息管理模块)
(1)在 IDEA 中新建 Maven 项目 gms(Grade Management System),启动
MySQL 数据库服务,采用本地 Tomcat 配置项目的 Web 服务环境。
(2)登录 MySQL 数据库,执行下列 SQL 脚本。
-- student 数据库创建示例
create database student character set gbk;
use student;
-- 设计客户端默认字符集
SET @saved_cs_client = @@character_set_client;
SET @@character_set_client = gbk;
-- 含指定引擎和默认字符集
create table stu(
sno char(9) primary key,
sname varchar(30) not null,
ssex char(2) not null,
snative varchar(30),
mno int
)ENGINE=InnoDB DEFAULT CHARSET=gbk;
set names gbk;
insert into stu values('100000001','尚小云','女','广东广州',1);
insert into stu values('100000002','廖时飞','男','广东梅州',1);
insert into stu values('100000003','宋凌枫','男','湖南郴州',2);
insert into stu values('100000004','刘小纳', '女','广东佛山',2);
create table course(
cno int primary key,
cname varchar(50) not null,
2
period int
)ENGINE=InnoDB DEFAULT CHARSET=gbk;
set names gbk;
insert into course values(1,'高等数学',80);
insert into course values(2,'大学英语',70);
insert into course values(3,'数据结构',70);
insert into course values(4,'数据库原理与应用',70);
create table teacher(
tno int primary key,
tname varchar(24) not null,
tsex char(2) not null,
tel varchar(20)
)ENGINE=InnoDB DEFAULT CHARSET=gbk;
set names gbk;
insert into teacher values(1,'袁怀斌','男','13590909090');
insert into teacher values(2,'杨文远','男','13588888888');
insert into teacher values(3,'周云霞','女','13511118888');
create table sc(
sno char(9),
cno int,
tno int,
participation float,
final float,
total float,
constraint fk_sc_stu foreign key(sno) references stu(sno),
constraint fk_sc_course foreign key(cno) references course(cno),
constraint fk_sc_teacher foreign key(tno) references teacher(tno),
constraint pk_sc primary key(sno,cno,tno)
)ENGINE=InnoDB DEFAULT CHARSET=gbk;
set names gbk;
insert into sc values('100000001',1,1,80,87,85);
insert into sc values('100000001',2,2,85,75,81);
insert into sc values('100000002',1,1,78,82,80);
-- 恢复客户端默认字符集
SET @@character_set_client = @saved_cs_client;
(3)根据三个框架的要求,在 pom 文件中配置好依赖。
(4)在 webapp 目录中修改系统首页 index.jsp,提供进入学生信息管理的
3
超链接,内容如下。
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>成绩管理系统(GMS)</title>
</head>
<body>
<a href="studentlist">学生信息管理</a>
</body>
</html>
(5)在/WEB-INF/jsp/student 目录下,新建 studentlist.jsp 文件,提供学生信
息的列表显示,以及学生信息的添加、删除和更新操作,内容如下。
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学生信息列表</title>
<script>
function frmSubmit(){
document.form1.submit();
}
</script>
</head>
<body>
<center>学生信息</center>
<form id="form1" name="form1" method="post" action="studentdelete">
<table align="center" width="500" border="1" cellspacing="0"
cellpadding="0" style="border-collapse:collapse"
bordercolor="#0099FF">
<tr>
<td>选择</td>
<td>学号</td>
<td>姓名</td>
<td>性别</td>
4
<td>籍贯</td>
<td>专业号</td>
<td>操作 <a href="studentpreinsert">添加
</a> <a href="#" onclick="javascript:frmSubmit();">删除
</a></td>
</tr>
<c:forEach items="${studentList}" var="student">
<tr>
<td><input type="checkbox" name="snoArray"
value="${student.sno}"></td>
<td>${student.sno}</td>
<td>${student.sname}</td>
<td>${student.ssex}</td>
<td>${student.snative}</td>
<td>${student.mno}</td>
<td>
<a
href="studentpreupdate?sno=${student.sno}&sname=${student.sname}&ss
ex=${student.ssex}&snative=${student.snative}&mno=${student.mno}">
修改</a>
</td>
</tr>
</c:forEach>
</table>
</form>
</body>
</html>
说明:该网页中用到了 JSTL,因此需要使用标签<%@ taglib prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>导入标签库。
(6)在/WEB-INF/jsp/student 目录下,新建 studentupdate.jsp 文件,提供学
生信息的修改表单,内容如下。
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改学生信息</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="studentupdate">
<table align="center" width="500" border="1" cellspacing="0"
剩余16页未读,继续阅读
资源评论
2301_78272797
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功