1.设计表
2.javabean
packagecom.cir.bean;public classUser {private intid;privateString username;privateString password;private intpermissionId;private intstatus;privateString position;public intgetId() {returnid;
}public void setId(intid) {this.id =id;
}publicString getUsername() {returnusername;
}public voidsetUsername(String username) {this.username =username;
}publicString getPassword() {returnpassword;
}public voidsetPassword(String password) {this.password =password;
}public intgetPermissionId() {returnpermissionId;
}public void setPermissionId(intpermissionId) {this.permissionId =permissionId;
}public intgetStatus() {returnstatus;
}public void setStatus(intstatus) {this.status =status;
}publicString getPosition() {returnposition;
}public voidsetPosition(String position) {this.position =position;
}
}
packagecom.cir.bean;//公文信息
public classDoc {private intid;private String tipplace; //副厂长审核意见位置
private String tipfplace; //厂长审签意见位置
private int deletestaus; //公文的删除状态
private int callback; //该公文回执信息的接受状态
privateString title;private String owner;//发送者
privateString receiver;privateString time;private int status; //流转状态
private intresult;publicString getTitle() {returntitle;
}public voidsetTitle(String title) {this.title =title;
}publicString getOwner() {returnowner;
}public voidsetOwner(String owner) {this.owner =owner;
}publicString getReceiver() {returnreceiver;
}public voidsetReceiver(String receiver) {this.receiver =receiver;
}publicString getTime() {returntime;
}public voidsetTime(String time) {this.time =time;
}public intgetStatus() {returnstatus;
}public void setStatus(intstatus) {this.status =status;
}public intgetResult() {returnresult;
}public void setResult(intresult) {this.result =result;
}publicString getPlace() {returnplace;
}public voidsetPlace(String place) {this.place =place;
}private String place; //公文存储位置
public intgetId() {returnid;
}public void setId(intid) {this.id =id;
}publicString getTipplace() {returntipplace;
}public voidsetTipplace(String tipplace) {this.tipplace =tipplace;
}publicString getTipfplace() {returntipfplace;
}public voidsetTipfplace(String tipfplace) {this.tipfplace =tipfplace;
}public intgetDeletestaus() {returndeletestaus;
}public void setDeletestaus(intdeletestaus) {this.deletestaus =deletestaus;
}public intgetCallback() {returncallback;
}public void setCallback(intcallback) {this.callback =callback;
}
}
packagecom.cir.bean;//用户权限
public classPermission {private intid;private intpermission;public intgetId() {returnid;
}public void setId(intid) {this.id =id;
}public intgetPermission() {returnpermission;
}public void setPermission(intpermission) {this.permission =permission;
}
}
2.工具类
packagecom.cir.util;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.SQLException;public classDBUtil {//数据库连接地址
private static String URL = "jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC";//数据库用户名
private static String UserName = "root";//数据库密码
private static String Password = "18735";public staticConnection getConnection()
{ Connection Conn=null;try{
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("加载驱动成功");
}catch(ClassNotFoundException e) {//TODO Auto-generated catch block
e.printStackTrace();
}try{//通过DriverManager类的getConenction方法指定三个参数,连接数据库
Conn =DriverManager.getConnection(URL, UserName, Password);
System.out.println("连接数据库成功!!!");//返回连接对象//return Conn;
}catch(SQLException e) {//TODO: handle exception
e.printStackTrace();
}returnConn;
}
//还应涉及对数据表的操作
}
3.相关jsp页面
pageEncoding="UTF-8"%>
href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
登录* {
padding: 0px;
margin: 0px;
}
.header {
width: 100%;
height: 120px;
background-color: gray;
text-align: center;
}
.container {
width: 100%;
height: 780px;
position: relative;
background-color: blue;
}
.login {
width: 500px;
height: auto;
background-color: white;
position: absolute;
top: 200px;
left: 500px;
border-radius: 8px;
}
label {
float: left;
width: 100px;
margin-top: 7px;
margin-right: 5px;
}
.form-control {
width: 60%;
}
.logtip {
padding-top: 20px;
padding-bottom: 20px;
border-bottom: 2px solid red;
text-align: center;
}
.form-group {
margin-left: 40px;
margin-top: 40px;
}
.btn {
height: 50px;
width: 100px;
float: left;
border-radius: 10px;
}
.logbtn {
margin-right: 20px;
}
.btnbag {
margin-left: 140px;
margin-right: 140px;
height: 50px;
overflow: hidden;
margin-top: 30px;
margin-bottom: 40px;
}
登录河北金力集团公文流转系统
登录
用户名
name="username">
密码
name="password">
οnclick="login()" value="登录">
class="btn btn-primary mangbtn" οnclick="entermang()" value="进入管理">
function login()
{
var username=$("#username").val();
var pasword=$("password").val();
if(username==""||password=="")
alert("请将信息填写完整!");
else
{
$.post
{
"login_do"
{
username:username,
password:password},
function(data)
{
if(data=="yes")
{
alert("登录成功!");
window.location="backmainpage.jsp";
}
else
{
alert("用户名或密码错误!或用户已被暂停使用!");
},"text"
};
}
}
}