目录
实现流程和思路
项目视频演示
设置数据库studenttest
①、创建user表
创建项目
jsp页面
登录界面login.jsp
主界面mainPage.jsp
添加学生信息AddUser.jsp
修改学生信息change.jsp
Servlet下
登录LoginServlet
查找SearchServlet
删除DeleteServlet
修改ChangeServlet
添加addServlet
Service下
FileServic接口下
FileServiceImpl实现类下
pojo下
User学生类
Dao下
FileDao接口下
FileDaoImpl实现类下
utils下
JDBCUtils
实现流程和思路
创建jsp页面,然后转发到servlet下,接受jsp页面传过来的值,拿着这些值去访问service服务层接口,服务层写个实类,这个实现类去服务层的接口,然后这个服务层的实现类再去访问dao层的接口,在持久层dao中在编写一个dao层接口的实现类去实现dao层的接口,最后在dao层的的实现类去访问数据库。
图示:
设置数据库studenttest
①、创建user表
其中包括设置删除的u_isdelete(0是存在,1是删除)
create table user(
u_name varchar(20),
u_id int primary key auto_increment,
u_pwd varchar(20) ,
u_phone varchar(20) not null,
u_role int not null,
u_isdelete int not null
)
charset=utf8;
创建项目
项目界面总览
jsp页面
登录界面login.jsp
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%
String path = request.getContextPath();
String basepath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
<base href="<%=basepath %>"/>
<meta charset="utf-8"/>
<title>登录界面</title>
<%-- css代码--%>
<style>
#fame_{
width: 500px;
height: 400px;
margin-left: 600px;
margin-top: 200px;
background-color: aqua;
/*边框黑色 实线 2像素*/
border: black solid 2px;
}
#inner_{
margin-left: 140px;
margin-top: 160px;
}
</style>
</head>
<body>
<h1 align="center" style="color: red">登录界面</h1>
<div id="fame_" >
<div id="inner_">
用户:<input type="text" id="u_id">
<b> <span id="span1" style="color: crimson">${error}</span></b><br><br>
密码:<input type="pa