课上作业—公文流转系统

公文流转才给用的Bean层DBUtil和Servlet三层机构公文流转大部分 功能实现但是还是有一些没有实现还有功能有错误

Bean层分为:

      从 数据库往界面写功能

复制代码
package bean;

public class chadao {
private int pid;
private String gongneng;
private String url;
public int getPid() {
    return pid;
}
public void setPid(int pid) {
    this.pid = pid;
}
public String getGongneng() {
    return gongneng;
}
public void setGongneng(String gongneng) {
    this.gongneng = gongneng;
}
public String getUrl() {
    return url;
}
public void setUrl(String url) {
    this.url = url;
}
public chadao(int pid, String gongneng, String url) {
    super();
    this.pid = pid;
    this.gongneng = gongneng;
    this.url = url;
}

}
复制代码

  公文 具体的功能的bean

    

复制代码
package bean;

public class Gongwen {
private String title;
private String owner;
private String time;
private String receiver;
private String status;
private String result;
private String place;
private String Cyijian;
private String Fyijian;
private String altitude;
private String callback;

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 String getStatus() {
    return status;
}
public void setStatus(String status) {
    this.status = status;
}
public String getResult() {
    return result;
}
public void setResult(String result) {
    this.result = result;
}
public String getPlace() {
    return place;
}
public void setPlace(String place) {
    this.place = place;
}
public String getCyijian() {
    return Cyijian;
}
public void setCyijian(String cyijian) {
    Cyijian = cyijian;
}
public String getFyijian() {
    return Fyijian;
}
public void setFyijian(String fyijian) {
    Fyijian = fyijian;
}
public String getAltitude() {
    return altitude;
}
public void setAltitude(String altitude) {
    this.altitude = altitude;
}

public String getCallback() {
    return callback;
}
public void setCallback(String callback) {
    this.callback = callback;
}
public Gongwen( String title, String owner, String time, String receiver, String status, String result,
        String place, String cyijian, String fyijian, String altitude, String back) {
    super();

    this.title = title;
    this.owner = owner;
    this.time = time;
    this.receiver = receiver;
    this.status = status;
    this.result = result;
    this.place = place;
    Cyijian = cyijian;
    Fyijian = fyijian;
    this.altitude = altitude;
    this.callback = back;
}
private int id;
public int getId() {
    return id;
}
public void setId(int id) {
    this.id = id;
}

public Gongwen(int id,String title, String owner, String time, String status, String place, String altitude,String Fyijian) {
    super();
    this.id=id;
    this.title = title;
    this.owner = owner;
    this.time = time;
    this.status = status;
    this.place = place;
    this.altitude = altitude;
    this.Fyijian=Fyijian;

}
public Gongwen(int id,String title, String owner, String time, String status, String place, String altitude,String Fyijian,String c,String back) {
    super();
    this.id=id;
    this.title = title;
    this.owner = owner;
    this.time = time;
    this.status = status;
    this.place = place;
    this.altitude = altitude;
    this.Fyijian=Fyijian;
    this.Cyijian=c;
    this.callback=back;
}

}
复制代码

  Bean层最后一个用户的类

复制代码
package bean;

public class User {
private int id;

public int getId() {
    return id;
}
public void setId(int id) {
    this.id = id;
}
private String username;
private String  password;
private String permissionId;
private int status;
private String job;

public String getJob() {
    return job;
}
public void setJob(String job) {
    this.job = 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 String getPermissionId() {
    return permissionId;
}
public void setPermissionId(String permissionId) {
    this.permissionId = permissionId;
}
public int getStatus() {
    return status;
}
public void setStatus(int status) {
    this.status = status;
}
public User(String username, String password) {
    super();
    this.username = username;
    this.password = password;
}
public User(String username, String password, String permissionId, int status, String job) {
    super();
    this.username = username;
    this.password = password;
    this.permissionId = permissionId;
    this.status = status;
    this.job = job;
}



public User(int id, String username, String permissionId, int status, String job) {
    super();
    this.id = id;
    this.username = username;
    this.permissionId = permissionId;
    this.status = status;
    this.job = job;
}


}
复制代码

  servlet

  层太多具体看附件

  DBUtil层

复制代码
package DBUtil;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * 数据库连接工具
 *
 */
public class DButil {
    //联结字符串                                              //数据库名test
    public static String db_url = "jdbc:mysql://localhost:3306/doc_system?&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC";
    //数据库用户名
    public static String db_user = "root";
    //数据库密码名
    public static String db_pass = "root";
    
    public static Connection getConn () {
        
        //声明与数据库的连接并实例化为null
        Connection conn = null;
        
        try {
            //驱动程序名
            Class.forName("com.mysql.cj.jdbc.Driver");//连接数据库
            //具体地连接到数据库——联接字符串(数据库名),联接用户名,联接密码名
            conn = DriverManager.getConnection(db_url, db_user, db_pass);
        } catch (Exception e) {
            e.printStackTrace();
        }
        
        return conn;
    }
    
    /**
     * 关闭连接
     * @param state
     * @param conn
     */
    public static void close (Statement state, Connection conn) {
        if (state != null) {
            try {
                state.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        
        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
    
    public static void close (ResultSet rs, Statement state, Connection conn) {
        if (rs != null) {
            try {
                rs.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        
        if (state != null) {
            try {
                state.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        
        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }

}
复制代码

  界面也是附件

实验结果

 

 

 

 

 

 

原文地址:https://www.cnblogs.com/jiaoaoshirenjinbu/p/12158728.html