Document Flow System

    First, write the first three entity classes.

1. User Login:

package com.official.bean;

public class Users {
private int id;
private String username;
private String password;
private int permissionId;
private int status;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
private String job;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getPermissionId() {
return permissionId;
}
public void setPermissionId(int permissionId) {
this.permissionId = permissionId;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}

}

2. permission settings:

package com.official.bean;

public class Permission {
private int id;
private int permission;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPermission() {
return permission;
}
public void setPermission(int permission) {
this.permission = permission;
}
}

 

3. Document type:

package com.official.bean;

public class Doc {
private int id;
private String tipplace;
private String ftipplace;
private int deletestatus;
private int callback;
public int getCallback() {
return callback;
}
public void setCallback(int callback) {
this.callback = callback;
}
public int getDeletestatus() {
return deletestatus;
}
public void setDeletestatus(int deletestatus) {
this.deletestatus = deletestatus;
}
public String getFtipplace() {
return ftipplace;
}
public void setFtipplace(String ftipplace) {
this.ftipplace = ftipplace;
}
public String getTipplace() {
return tipplace;
}
public void setTipplace(String tipplace) {
this.tipplace = tipplace;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
private String title;
private String owner;
private String time;
private String receiver;
private int status;
private int result;
private String place;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getReceiver() {
return receiver;
}
public void setReceiver(String receiver) {
this.receiver = receiver;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getResult() {
return result;
}
public void setResult(int result) {
this.result = result;
}
public String getPlace() {
return place;
}
public void setPlace(St

ring place) {

this.place = place;
}
}

Second, connect to the database

package com.official.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import com.official.bean.Doc;
import com.official.bean.Permission;
import com.official.bean.Users;


public class DBUtil {
//数据库URL和账号密码
private static final String connectionURL="jdbc:mysql://127.0.0.1:3306/doc_system?useUnicode=true&characterEncoding=GB18030&useSSL=false&serverTimezone=GMT&allowPublicKeyRetrieval=true";
private static final String username="root";
private static final String password="root";

//数据库连接
public static Connection getConnection()
{
try {
Class.forName("com.mysql.cj.jdbc.Driver");
return DriverManager.getConnection(connectionURL,username,password);
} catch (Exception e) {
// TODO: handle exception
System.out.println("数据库连接失败");
e.printStackTrace();
return null;
}
}
public static void closeAll(Connection connection,PreparedStatement statement,ResultSet rSet)
{
try {
if(connection!=null)
connection.close();
} catch (SQLException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}

try {
if(statement!=null)
statement.close();
} catch (SQLException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}

try {
if(rSet!=null)
rSet.close();
} catch (SQLException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}
}

Third, write the main login screen

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
<title>登录</title>
<style type="text/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;
}
</style>
</head>
<body>
<div class="header"><h2>河北金力集团公文流转系统</h2></div>

<div class="container">
<div class="login">
<h2 class="logtip">登录</h2>
<form action="login_do" method="post">
<div class="form-group">
<label for="username">用户名</label>
<input type="text" class="form-control" id="username" name="username">
</div>
<div class="form-group">
<label for="password">密码</label>
<input type="password" class="form-control" id="password" name="password">
</div>
<div class="btnbag">
<input type="button" class="btn btn-primary logbtn" onclick="login()" value="登录">
<input type="button" class="btn btn-primary mangbtn" onclick="entermang()" value="进入管理">
</div>
</form>
</div>
</div>

<div class="footer"></div>
</body>
<script>
function login()
{
var username=$("#username").val();
var password=$("#password").val();
if(username==""||password=="")
alert("请将信息填写完整!");
else
{
$.post(
"login_do",
{username:username,
password:password},
function(data){
if(data=="yes")
{
alert ( "successful landing!");
window.location = "mainpage.jsp";
}
the else
alert ( "user name or password is incorrect or the user has been suspended!!");
},
"text"
);
}
}
function entermang ()
{
var username = $ ( "# username") Val ();.
. = $ var password ( "password #") Val ();
IF (username == "" || password == "")
Alert ( "Please be filled out completely!");
the else
{
$ .post (
"login_do",
{username: username,
password: password},
function (the Data) {
IF (the Data == "yes")
{
Alert ( "success landing ");!
window.location =" backmainpage.jsp ";
}
The else
Alert ( "user name or password is incorrect or the user has been suspended!!");
}
"text"
);
}
}
</script>
</html>

 

 

Guess you like

Origin www.cnblogs.com/hang-hang/p/12012148.html