使用纯粹的Servlet完成单表【对部门的】的增删改查操作。(B/S结构)
该操作方法的问题所在:
drop table if exists dept;
# 部门表
create table dept(
deptno int primary key,
dename varchar(255),
loc varchar(255)
);
# 添加数据
insert into dept(deptno, dename, loc) values(10, 'XiaoShouBu', 'BEIJING');
insert into dept(deptno, dename, loc) values(20, 'YanFaBu', 'SHANGHAI');
insert into dept(deptno, dename, loc) values(30, 'JiShuBu', 'GUANGZHOU');
insert into dept(deptno, dename, loc) values(40, 'MeiTiBu', 'SHENZHEN');
select *from dept;
以下目前代码为各页面:
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>欢迎使用OA系统title>
head>
<body>
<a href="list.html">查看部门列表a>
body>
html>
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>部门列表页面title>
head>
<body>
<h1 align="center">部门列表h1>
<hr>
<table border="1px" align="center" width="50%">
<tr>
<th>序号th>
<th>部门编号th>
<th>部门名称th>
<th>操作th>
tr>
<tr>
<td>1td>
<td>10td>
<td>销售部td>
<td>
删除a>
<a href="edit.html">修改a>
<a href="detail.html">详情a>
td>
tr>
<tr>
<td>2td>
<td>20td>
<td>研发部td>
<td>
删除a>
<a href="edit.html">修改a>
<a href="detail.html">详情a>
td>
tr>
<tr>
<td>3td>
<td>30td>
<td>运营部td>
<td>
删除a>
<a href="edit.html">修改a>
<a href="detail.html">详情a>
td>
tr>
table>
<hr>
<a href="add.html">新增部门a>
body>
html>
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>新增部门title>
head>
<body>
<h1>新增部门h1>
<hr >
<form action="list.html" method="post">
部门编号<input type="text" name="deptno"/><br>
部门名称<input type="text" name="dename"/><br>
部门位置<input type="text" name="loc"/><br>
<input type="submit" value="保存"/><br>
form>
body>
html>
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>修改部门title>
head>
<body>
<h1>修改部门h1>
<hr >
<form action="list.html" method="get">
部门编号<input type="text" name="deptno" value="20" readonly /><br>
部门名称<input type="text" name="dename" value="销售部"/><br>
部门位置<input type="text" name="loc" value="北京"/><br>
<input type="submit" value="修改"/><br>
form>
body>
html>
DOCTYPE html>
<html lang="en">
<head>
<meta charset