会议室预约

 

 

 

 

 

 

 

 

 

 

 

bean类:

 

 

huiyishixinxi.java

 

 

复制代码
package bean;

public class huiyishixinxi {
private String MeetroomId;
private String MeetroomName;
private String Address;
private String ReadyState;
private String Status;
private String Capacity;
public String getMeetroomId() {
    return MeetroomId;
}
public void setMeetroomId(String meetroomId) {
    MeetroomId = meetroomId;
}
public String getMeetroomName() {
    return MeetroomName;
}
public void setMeetroomName(String meetroomName) {
    MeetroomName = meetroomName;
}
public String getAddress() {
    return Address;
}
public void setAddress(String address) {
    Address = address;
}
public String getReadyState() {
    return ReadyState;
}
public void setReadyState(String readyState) {
    ReadyState = readyState;
}
public String getStatus() {
    return Status;
}
public void setStatus(String status) {
    Status = status;
}
public String getCapacity() {
    return Capacity;
}
public void setCapacity(String capacity) {
    Capacity = capacity;
}
public huiyishixinxi(String meetroomId,String meetroomName,String address,String readyState,String status,String capacity)
{
    MeetroomId = meetroomId;
    MeetroomName = meetroomName;
    Address = address;
    ReadyState = readyState;
    Status = status;
    Capacity = capacity;
}
}
复制代码

 

huiyixinxi.java

 

复制代码
package bean;

public class huiyixinxi {
    private String MeetingID;
    private String MeetingName;
    private String MeetingContent;
    private String MeetingBegin;
    private String MeetingEnd;
    private String MeetingNum;
    private String Participants;
    private String MeetroomId;
    private String UserID;
    private String AuditStatus;
    private String AuditMind;
    public String getMeetingID() {
        return MeetingID;
    }
    public void setMeetingID(String meetingID) {
        MeetingID = meetingID;
    }
    public String getMeetingName() {
        return MeetingName;
    }
    public void setMeetingName(String meetingName) {
        MeetingName = meetingName;
    }
    public String getMeetingContent() {
        return MeetingContent;
    }
    public void setMeetingContent(String meetingContent) {
        MeetingContent = meetingContent;
    }
    public String getMeetingBegin() {
        return MeetingBegin;
    }
    public void setMeetingBegin(String meetingBegin) {
        MeetingBegin = meetingBegin;
    }
    public String getMeetingEnd() {
        return MeetingEnd;
    }
    public void setMeetingEnd(String meetingEnd) {
        MeetingEnd = meetingEnd;
    }
    public String getMeetingNum() {
        return MeetingNum;
    }
    public void setMeetingNum(String meetingNum) {
        MeetingNum = meetingNum;
    }
    public String getParticipants() {
        return Participants;
    }
    public void setParticipants(String participants) {
        Participants = participants;
    }
    public String getMeetroomId() {
        return MeetroomId;
    }
    public void setMeetroomId(String meetroomId) {
        MeetroomId = meetroomId;
    }
    public String getUserID() {
        return UserID;
    }
    public void setUserID(String userID) {
        UserID = userID;
    }
    public String getAuditStatus() {
        return AuditStatus;
    }
    public void setAuditStatus(String auditStatus) {
        AuditStatus = auditStatus;
    }
    public String getAuditMind() {
        return AuditMind;
    }
    public void setAuditMind(String auditMind) {
        AuditMind = auditMind;
    }
    
}
复制代码

 

 

zhiyuanxinxi.java

复制代码
package bean;

public class zhiyuanxinxi {
    private String UserID;
    private String UserName;
    private String sex;
    private String department;
    private String Phone;
    private String Position;
    public String getUserID() {
        return UserID;
    }
    public void setUserID(String userID) {
        UserID = userID;
    }
    public String getUserName() {
        return UserName;
    }
    public void setUserName(String userName) {
        UserName = userName;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getDepartment() {
        return department;
    }
    public void setDepartment(String department) {
        this.department = department;
    }
    public String getPhone() {
        return Phone;
    }
    public void setPhone(String phone) {
        Phone = phone;
    }
    public String getPosition() {
        return Position;
    }
    public void setPosition(String position) {
        Position = position;
    }
    
}
复制代码

 

dao类:

dao.java

复制代码
package dao;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;
import bean.*;
import java.sql.ResultSet;
import java.sql.Statement;
import dbutil.DBUtil;
public class dao {
    public int adduser(String number,String password,String user)
    {
        Connection conn = DBUtil.getConn();//这里就是从DBUtil类里面得到连接
        Statement state =null;
        ResultSet rs = null;
        int flag=0;
        try
        {
            String sql = "insert into yonghu(number,password,user)values('"+number+"','"+password+"','"+user+"')";
            state = conn.createStatement();
            int count = state.executeUpdate(sql);
            if(count>0) {
                System.out.println("数据插入成功");
            }else {
                System.out.println("数据插入失败了QAQ");
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        finally
        {
            DBUtil.close(rs, state, conn);
        }
        return flag;
    }
    public String login(String number,String password,String user)
    {
        Connection conn = DBUtil.getConn();//这里就是从DBUtil类里面得到连接
        Statement state =null;
        ResultSet rs = null;
        int flag=0;
        String user2;
        try
        {
            String sql = "select * from yonghu";
            state = conn.createStatement();
            rs=state.executeQuery(sql);
            while(rs.next())
            {
                String number1=rs.getString("number");
                String password1=rs.getString("password");
                String user1=rs.getString("user");
                if(number1.equals(number)&&password1.equals(password)&&user1.equals(user))
                {
                    user2=user1;
                    //System.out.println(user1);
                    return user1;
                }
            }
            
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        finally
        {
            DBUtil.close(rs, state, conn);
        }
        return "错误";
    }
    public int addzhiyuan(String UserID,String UserName,String sex,String department,String Phone,String Position)
    {
        Connection conn = DBUtil.getConn();//这里就是从DBUtil类里面得到连接
        Statement state =null;
        ResultSet rs = null;
        int flag=0;
        try
        {
            String sql = "insert into zhiyuanxinxi(UserID,UserName,sex,department,Phone,Position)values('"+UserID+"','"+UserName+"','"+sex+"','"+department+"','"+Phone+"','"+Position+"')";
            state = conn.createStatement();
            int count = state.executeUpdate(sql);
            if(count>0) {
                System.out.println("数据插入成功");
            }else {
                System.out.println("数据插入失败了QAQ");
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        finally
        {
            DBUtil.close(rs, state, conn);
        }
        return flag;
    }
    public int addhuiyishixinxi(String MeetroomId,String MeetroomName,String Address,String ReadyState,String Status,String Capacity)
    {
        Connection conn = DBUtil.getConn();//这里就是从DBUtil类里面得到连接
        Statement state =null;
        ResultSet rs = null;
        int flag=0;
        try
        {
            String sql = "insert into huiyishixinxi(MeetroomId,MeetroomName,Address,ReadyState,Status,Capacity)values('"+MeetroomId+"','"+MeetroomName+"','"+Address+"','"+ReadyState+"','"+Status+"','"+Capacity+"')";
            state = conn.createStatement();
            int count = state.executeUpdate(sql);
            if(count>0) {
                System.out.println("数据插入成功");
            }else {
                System.out.println("数据插入失败了QAQ");
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        finally
        {
            DBUtil.close(rs, state, conn);
        }
        return flag;
    }
    public static List<huiyishixinxi> selecthuiyishixinxi()
    { 
        String sql = "select * from huiyishixinxi";
        Connection conn = DBUtil.getConn();//这里就是从DBUtil类里面得到连接
        Statement state =null;
        List<huiyishixinxi> list = new ArrayList<>();
        ResultSet rs = null;
        int flag=0;
        try
        {
           
            state = conn.createStatement();
            rs=state.executeQuery(sql);
            huiyishixinxi kc=null;
            while(rs.next())
            {
                String MeetroomId=rs.getString("MeetroomId");
                String MeetroomName=rs.getString("MeetroomName");
                String Address=rs.getString("Address");
                String ReadyState=rs.getString("ReadyState");
                String Status=rs.getString("Status");
                String Capacity=rs.getString("Capacity");
                kc =new huiyishixinxi(MeetroomId,MeetroomName,Address,ReadyState,Status,Capacity);
                //System.out.println(name+"=========");
                list.add(kc);
            }
           // System.out.println("3");
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        finally
        {
            DBUtil.close(rs, state, conn);
        }
        return list;
    }
    public int updatahuiyishixinxi(String MeetroomId,String MeetroomName,String Address,String ReadyState,String Status,String Capacity)
    {
        Connection conn = DBUtil.getConn();//这里就是从DBUtil类里面得到连接
        Statement state =null;
        ResultSet rs = null;
        int flag=0;
        try
        {
            String sql = "update huiyishixinxi set MeetroomName='"+MeetroomName+"',Address='"+Address+"',ReadyState='"+ReadyState+"',Status='"+Status+"',Capacity='"+Capacity+"' where MeetroomId='"+MeetroomId+"' ";
            state = conn.createStatement();
            int count = state.executeUpdate(sql);
            if(count>0) {
                System.out.println("数据插入成功");
            }else {
                System.out.println("数据插入失败了QAQ");
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        finally
        {
            DBUtil.close(rs, state, conn);
        }
        return flag;
    }
    public int shanchuhuiyishixinxi(String MeetroomId)
    {
        Connection conn = DBUtil.getConn();//这里就是从DBUtil类里面得到连接
        Statement state =null;
        ResultSet rs = null;
        int flag=0;
        try
        {
            String sql = "delete from huiyishixinxi where MeetroomId = '"+MeetroomId+"'";
            state = conn.createStatement();
            int count = state.executeUpdate(sql);
            if(count>0) {
                System.out.println("数据插入成功");
            }else {
                System.out.println("数据插入失败了QAQ");
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        finally
        {
            DBUtil.close(rs, state, conn);
        }
        return flag;
    }
    public static List<huiyishixinxi> zhiyuanselecthuiyishixinxi()
    { 
        String sql = "select * from huiyishixinxi where ReadyState='可用'";
        Connection conn = DBUtil.getConn();//这里就是从DBUtil类里面得到连接
        Statement state =null;
        List<huiyishixinxi> list = new ArrayList<>();
        ResultSet rs = null;
        int flag=0;
        try
        {
           
            state = conn.createStatement();
            rs=state.executeQuery(sql);
            huiyishixinxi kc=null;
            while(rs.next())
            {
                String MeetroomId=rs.getString("MeetroomId");
                String MeetroomName=rs.getString("MeetroomName");
                String Address=rs.getString("Address");
                String ReadyState=rs.getString("ReadyState");
                String Status=rs.getString("Status");
                String Capacity=rs.getString("Capacity");
                kc =new huiyishixinxi(MeetroomId,MeetroomName,Address,ReadyState,Status,Capacity);
                //System.out.println(name+"=========");
                list.add(kc);
            }
           // System.out.println("3");
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        finally
        {
            DBUtil.close(rs, state, conn);
        }
        return list;
    }
    public int zhiyuanxiugaimima(String password1,String password2)
    {
        Connection conn = DBUtil.getConn();//这里就是从DBUtil类里面得到连接
        Statement state =null;
        ResultSet rs = null;
        int flag=0;
        try
        {
            String sql = "update yonghu set password='"+password2+"' where password=password1 ";
            state = conn.createStatement();
            int count = state.executeUpdate(sql);
            if(count>0) {
                System.out.println("数据插入成功");
            }else {
                System.out.println("数据插入失败了QAQ");
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        finally
        {
            DBUtil.close(rs, state, conn);
        }
        return flag;
    }
    public static List<huiyishixinxi> chaxunselecthuiyishixinxi(String ReadyState1,String Capacity1)
    { 
        String sql = "select * from huiyishixinxi where ReadyState=ReadyState1";
        Connection conn = DBUtil.getConn();//这里就是从DBUtil类里面得到连接
        Statement state =null;
        List<huiyishixinxi> list = new ArrayList<>();
        ResultSet rs = null;
        int flag=0;
        try
        {
           
            state = conn.createStatement();
            rs=state.executeQuery(sql);
            huiyishixinxi kc=null;
            while(rs.next())
            {
                String MeetroomId=rs.getString("MeetroomId");
                String MeetroomName=rs.getString("MeetroomName");
                String Address=rs.getString("Address");
                String ReadyState=rs.getString("ReadyState");
                String Status=rs.getString("Status");
                String Capacity=rs.getString("Capacity");
                kc =new huiyishixinxi(MeetroomId,MeetroomName,Address,ReadyState,Status,Capacity);
                //System.out.println(name+"=========");
                list.add(kc);
            }
           // System.out.println("3");
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        finally
        {
            DBUtil.close(rs, state, conn);
        }
        return list;
    }
    public int yuyuehuiyi(String MeetingID,String MeetingName,String MeetingContent,String MeetingBegin,String MeetingEnd,String MeetingNum,String Participants,String MeetroomId,String UserID,String AuditStatus)
    {
        Connection conn = DBUtil.getConn();//这里就是从DBUtil类里面得到连接
        Statement state =null;
        ResultSet rs = null;
        int flag=0;
        try
        {
            String sql = "insert into huiyixinxi(MeetingID,MeetingName,MeetingContent,MeetingBegin,MeetingEnd,MeetingNum,Participants,MeetroomId,UserID,AuditStatus)values('"+MeetingID+"','"+MeetingName+"','"+MeetingContent+"','"+MeetingBegin+"','"+MeetingEnd+"','"+MeetingNum+"','"+Participants+"','"+MeetroomId+"','"+UserID+"','"+AuditStatus+"')";
            state = conn.createStatement();
            int count = state.executeUpdate(sql);
            if(count>0) {
                System.out.println("数据插入成功");
            }else {
                System.out.println("数据插入失败了QAQ");
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        finally
        {
            DBUtil.close(rs, state, conn);
        }
        return flag;
    }
}
复制代码

 

dbutil类:

DBUtil.java

复制代码
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 {//这个类就是套模板如果需要用的时候只需要改数据库(db)的名字即可*******
    //public static String db_url="jdbc:mysql://localhost:3306/database?uerUnicode=true&characterEncoding=UTF-8";
    public static String db_url="jdbc:mysql://localhost:3306/database2?serverTimezone=GMT%2B8&serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8";//db是数据库的名字
    //这是连接数据库,servlet是数据库的名称,uerUnicode=true&characterEncoding=UTF-8是将字符集设置为utf-8,避免乱码。
    public static String db_user="root";//数据的用户名
    public static String db_password="UJuqCT-az5(f";//数据库的密码
    public static Connection getConn()//获取连接,返回Connection类型,必须设置为static这样才能在其他类中使用
    {
        Connection conn=null;
        try
        {
            Class.forName("com.mysql.cj.jdbc.Driver");//加载驱动
            conn=DriverManager.getConnection(db_url,db_user,db_password);//连接数据库
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        return 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();
            }
        }
    }
}
复制代码

 

servlet类:

Servlet.java

复制代码
package servlet;
import java.io.IOException;
import java.util.List;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import bean.*;
import dao.*;
@WebServlet("/r2")
public class Servlet extends HttpServlet{
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException {
        return;
    }
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");// 设置字符集,避免乱码
        // 获取jsp界面需要进行的操作,
        String method = req.getParameter("method");
        //System.out.println("============");
        if (method.equals("addyonghu"))// 转到login函数
        {
            addyonghu(req,resp);
           // System.out.println("正在执行信息录入操作");
        }
        if (method.equals("login"))// 转到login函数
        {
            login(req,resp);
        }
        if (method.equals("addhuiyishixinxi"))// 转到login函数
        {
            addhuiyishixinxi(req,resp);
        }
        if (method.equals("selecthuiyishixinxi"))// 转到login函数
        {
            //System.out.println("1");
            selecthuiyishixinxi(req,resp);
        }
        if (method.equals("updatahuiyishixinxi"))// 转到login函数
        {
            //System.out.println("1");
            updatahuiyishixinxi(req,resp);
        }
        if (method.equals("shanchuhuiyishixinxi"))// 转到login函数
        {
            //System.out.println("1");
            shanchuhuiyishixinxi(req,resp);
        }
        if (method.equals("zhiyuanselecthuiyishixinxi"))// 转到login函数
        {
            //System.out.println("1");
            zhiyuanselecthuiyishixinxi(req,resp);
        }
        if (method.equals("zhiyuanxiugaimima"))// 转到login函数
        {
            //System.out.println("1");
            zhiyuanxiugaimima(req,resp);
        }
        if (method.equals("chanxunselecthuiyishixinxi"))// 转到login函数
        {
            //System.out.println("1");
            chaxunselecthuiyishixinxi(req,resp);
        }
        if (method.equals("yuyuehuiyi"))// 转到login函数
        {
            //System.out.println("1");
            yuyuehuiyi(req,resp);
        }
    }
    private void addyonghu(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
         req.setCharacterEncoding("utf-8");
         resp.setContentType("text/html;charset=utf-8");
         String number=req.getParameter("number");
         String password = req.getParameter("password");
         String user=req.getParameter("user");
         String UserName=req.getParameter("UserName");
         String sex = req.getParameter("sex");
         String department=req.getParameter("department");
         String Phone = req.getParameter("Phone");
         String Position=req.getParameter("Position");
         
         //System.out.println(name);

         dao  userdao = new dao();
        // System.out.println("============");
         userdao.adduser(number,password,user);
        // System.out.println("============");
         userdao.addzhiyuan(number, UserName, sex, department, Phone, Position);
         req.getRequestDispatcher("/login.jsp").forward(req,resp);
    }
    private void login(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        String number=req.getParameter("number");
        String password = req.getParameter("password");
        String user=req.getParameter("user");
        //System.out.println(name);
        dao  userdao = new dao();
        String log=userdao.login(number,password,user);
        if(log.equals("管理员"))
        {
            req.getRequestDispatcher("/guanliyuandenglu.jsp").forward(req,resp);
            //System.out.println("select============");
        }
        else if(log.equals("职员"))
        {
            req.getRequestDispatcher("/zhiyuandenglu.jsp").forward(req,resp);
        }
        else req.getRequestDispatcher("/login.jsp").forward(req,resp);
    }
    private void addhuiyishixinxi(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        String MeetroomId=req.getParameter("MeetroomId");
        String MeetroomName = req.getParameter("MeetroomName");
        String Address=req.getParameter("Address");
        String ReadyState=req.getParameter("ReadyState");
        String Status = req.getParameter("Status");
        String Capacity=req.getParameter("Capacity");
        
        //System.out.println(name);

        dao  userdao = new dao();
       // System.out.println("============");
        userdao.addhuiyishixinxi(MeetroomId,MeetroomName,Address,ReadyState,Status,Capacity);
        req.getRequestDispatcher("/guanliyuandenglu.jsp").forward(req,resp);
   }
    private void selecthuiyishixinxi(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
       // System.out.println("12");
        List<huiyishixinxi> kc=dao.selecthuiyishixinxi();
        //System.out.println("2");
        req.setAttribute("kc", kc);
        req.getRequestDispatcher("selecthuiyishixinxi.jsp").forward(req, resp);
    }
    private void updatahuiyishixinxi(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
           req.setCharacterEncoding("utf-8");
           resp.setContentType("text/html;charset=utf-8");
           String MeetroomId=req.getParameter("MeetroomId");
           String MeetroomName = req.getParameter("MeetroomName");
           String Address=req.getParameter("Address");
           String ReadyState=req.getParameter("ReadyState");
           String Status = req.getParameter("Status");
           String Capacity=req.getParameter("Capacity");
           
           //System.out.println(name);

           dao  userdao = new dao();
          // System.out.println("============");
           userdao.updatahuiyishixinxi(MeetroomId,MeetroomName,Address,ReadyState,Status,Capacity);
           req.getRequestDispatcher("/guanliyuandenglu.jsp").forward(req,resp);
      }
    private void shanchuhuiyishixinxi(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
          req.setCharacterEncoding("utf-8");
          resp.setContentType("text/html;charset=utf-8");
          String MeetroomId=req.getParameter("MeetroomId");
          
          //System.out.println(name);

          dao  userdao = new dao();
         // System.out.println("============");
          userdao.shanchuhuiyishixinxi(MeetroomId);
          req.getRequestDispatcher("/guanliyuandenglu.jsp").forward(req,resp);
     }
    private void zhiyuanselecthuiyishixinxi(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
       // System.out.println("12");
        List<huiyishixinxi> kc=dao.zhiyuanselecthuiyishixinxi();
        //System.out.println("2");
        req.setAttribute("kc", kc);
        req.getRequestDispatcher("zhiyuanchakanhuiyishixinxi.jsp").forward(req, resp);
    }
    private void zhiyuanxiugaimima(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        String password1=req.getParameter("password1");
        String password2 = req.getParameter("password2");
        //System.out.println(name);
        dao  userdao = new dao();
        userdao.zhiyuanxiugaimima(password1, password2);
        req.getRequestDispatcher("/zhiyuandenglu.jsp").forward(req,resp);
   }
    private void chaxunselecthuiyishixinxi(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
       // System.out.println("12");
        resp.setContentType("text/html;charset=utf-8");
        String ReadyState=req.getParameter("ReadyState");
        String Capacity=req.getParameter("Capacity");
        List<huiyishixinxi> kc=dao.chaxunselecthuiyishixinxi(ReadyState,Capacity);
        //System.out.println("2");
        req.setAttribute("kc", kc);
        req.getRequestDispatcher("zhiyuandenglu.jsp").forward(req, resp);
    }
    private void yuyuehuiyi(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        String MeetingID=req.getParameter("MeetingID");
        String MeetingName = req.getParameter("MeetingName");
        String MeetingContent=req.getParameter("MeetingContent");
        String MeetingBegin=req.getParameter("MeetingBegin");
        String MeetingEnd = req.getParameter("MeetingEnd");
        String MeetingNum=req.getParameter("MeetingNum");
        String Participants = req.getParameter("Participants");
        String MeetroomId=req.getParameter("MeetroomId");
        String UserID=req.getParameter("UserID");
        String AuditStatus="待审核";
        //System.out.println(name);

        dao  userdao = new dao();
       // System.out.println("============");
        userdao.yuyuehuiyi(MeetingID,MeetingName,MeetingContent,MeetingBegin,MeetingEnd,MeetingNum,Participants,MeetroomId,UserID,AuditStatus);
        req.getRequestDispatcher("/zhiyuandenglu.jsp").forward(req,resp);
   }
 }
复制代码

 

 

HTML:

 

addhuiyishixinxi.jsp

复制代码
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style> 
body{text-align:center} 
</style>
</head>
<body>
<form action="/Test4/r2?method=addhuiyishixinxi"method="post" onsubmit="return check();">
                    <h1>请输入信息</h1>
                    1.会议室编号<input type="text" name="MeetroomId"> <br/>
                    2.会议室名称<input type="text" name="MeetroomName"> <br/>
                    3.会议室地址<input type="text" name="Address"> <br/>
                    4.可用状态<input type="text" name="ReadyState"> <br/>
                    5.目前状态<input type="text" name="Status"> <br/>
                    6.容纳人数<input type="text" name="Capacity"> <br/>
                    <input type ="submit" value="提交" >

</form>
</body>
</html>
复制代码

 

chanxunhuiyixinxi.java

复制代码
<%@page import="java.util.*"%>
<%@page import="bean.*"%>
<%@page import="dao.*"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style> 
body{text-align:center} 
</style>
</head>
<body>
<div align="center">
                    1.可用状态<input type="text" name="ReadyState"> <br/>
                    2.容纳人数<input type="text" name="Capacity"> <br/>
                    
        <h1 style="color: black;">huiyishi信息</h1>
        
        <table class="tb" border="">
        <tr>
            <tr>
                <th>会议室编号</th>
                <th>会议室名称</th>
                <th>会议室地址</th>
                <th>可用状态</th> 
                <th>目前状态</th> 
                <th>容纳人数</th> 
            </tr>
            <%List<huiyishixinxi> list=(List<huiyishixinxi>)request.getAttribute("kc");
            //String s="sd";
            //request.getSession().setAttribute("ss",s);
                for(huiyishixinxi kc : list){
             %>
             <tr>
                <td><%=kc.getMeetroomId() %></td>
                <td><%=kc.getMeetroomName() %></td>
                <td><%=kc.getAddress() %></td>
                <td><%=kc.getReadyState() %></td>
                <td><%=kc.getStatus() %></td>
                <td><%=kc.getCapacity() %></td>
                <td>    <a href="updatahuiyishixinxi.jsp">
            <button>修改会议室信息</button>
            </a>          </td>
              </tr>
             
             <%      
                }
            %>
                
        </table>
        <!--  
                <input type="hidden" name="ID" id="ID" value="${kc[0]}">
           
           <td><input type="hidden" name="name" id="name" value="${kc[1]}"></td>
         <tr>
           <td><input type="hidden" name="renshu" id="renshu" value="${kc[2]}"></td>
           </tr>
           <td><input type="hidden" name="jiaoshi" id="jiaoshi" value="${kc[4]}"></td>
           -->
</body>
</html>
复制代码

 

creatyonghu.jsp

复制代码
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style> 
body{text-align:center} 
</style>
</head>
<body>
<form action="/Test4/r2?method=addyonghu"method="post" onsubmit="return check();">
                    <h1>请输入信息</h1>
                    1.账号<input type="text" name="number"> <br/>
                    2.密码<input type="text" name="password"> <br/>
                    3.姓名<input type="text" name="UserName"> <br/>
                    4.性别<input type="text" name="sex"> <br/>
                    5.手机号码<input type="text" name="Phone"> <br/>
                    6.家庭住址<input type="text" name="Position"> <br/>
                    7.部门<input type="text" name="department"> <br/>
                    8.身份<input type="text" name="user"> <br/>
                    <input type ="submit" value="提交" >

</form>
</body>
</html>
复制代码

 

gukeliulandenglu.jsp

复制代码
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style> 
body{text-align:center} 
</style>
</head>
<body>
            <p>请选择所需功能</p>

            <a href="">
            <button>修改个人密码</button>
            </a>    
            <br>
            <br>        
            <a href="addhuiyishixinxi.jsp">
            <button>新增会议室信息</button>
            </a>    
            <br>
            <br>        
            <form action="/Test4/r2?method=selecthuiyishixinxi" method="post" onsubmit="return check();">
                <p>
                    <input type="submit" value="修改会议室信息">
                </p>
            </form>    
            <br>
            <br>    
            <a href="shanchuhuiyishixinxi.jsp">
            <button>删除会议室信息</button>
            </a>
            <br>
            <br>    
            <a href="">
            <button>审核职员注册</button>
            </a>        
</body>
</html>
复制代码

 

login.jsp

复制代码
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style> 
body{text-align:center} 
input{
    font-size: 20px;
    text-align: center;
}
</style>
</head>
<body>
<form action="/Test4/r2?method=login"method="post" onsubmit="return check();">
 <div id="登录界面">  
        <h1>Login</h1>  
            <table align="center">
                <tr>
                    <th>账号</th>
                    <td>
                    <input type="text" name="number">
                    </td>
                </tr>
                <tr>
                    <th>密码</th>
                    <td><input type="password" name = "password">
                    </td>
                </tr>        
                    <tr>
                    
                    <th>身份</th><td> <select name="user">
                    <option value="职员">职员</option>
                     <option value="管理员">管理员</option>
                    </select>    
                    </td>
                    </tr>
                <tr>
            <td colspan="2"><input type="submit" name="submit" value="提交"> <input type="reset" value="重置"></td>
                </tr>
            </table>
        </form>
        <div><a href="creatyonghu.jsp">创建用户</a> <a href="createyonghu.jsp"></a></div>  
    </div>
</body>
</html>
复制代码

 

selecthuiyishixinxi.jsp

复制代码
<%@page import="java.util.*"%>
<%@page import="bean.*"%>
<%@page import="dao.*"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style> 
body{text-align:center} 
</style>
</head>
<body>
<div align="center">
        <h1 style="color: black;">huiyishi信息</h1>
        <table class="tb" border="">
        <tr>
            <tr>
                <th>会议室编号</th>
                <th>会议室名称</th>
                <th>会议室地址</th>
                <th>可用状态</th> 
                <th>目前状态</th> 
                <th>容纳人数</th> 
            </tr>
            <%List<huiyishixinxi> list=(List<huiyishixinxi>)request.getAttribute("kc");
            //String s="sd";
            //request.getSession().setAttribute("ss",s);
                for(huiyishixinxi kc : list){
             %>
             <tr>
                <td><%=kc.getMeetroomId() %></td>
                <td><%=kc.getMeetroomName() %></td>
                <td><%=kc.getAddress() %></td>
                <td><%=kc.getReadyState() %></td>
                <td><%=kc.getStatus() %></td>
                <td><%=kc.getCapacity() %></td>
                <td>    <a href="updatahuiyishixinxi.jsp">
            <button>修改会议室信息</button>
            </a>          </td>
              </tr>
             
             <%      
                }
            %>
                
        </table>
        <!--  
                <input type="hidden" name="ID" id="ID" value="${kc[0]}">
           
           <td><input type="hidden" name="name" id="name" value="${kc[1]}"></td>
         <tr>
           <td><input type="hidden" name="renshu" id="renshu" value="${kc[2]}"></td>
           </tr>
           <td><input type="hidden" name="jiaoshi" id="jiaoshi" value="${kc[4]}"></td>
           -->
</body>
</html>
复制代码

 

shanchuhuiyishixinxi.jsp

复制代码
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style> 
body{text-align:center} 
</style>
</head>
<body>
<form action="/Test4/r2?method=shanchuhuiyishixinxi"method="post" onsubmit="return check();">
                    <h1>请输入信息</h1>
                    1.会议室编号<input type="text" name="MeetroomId"> <br/>
                    <input type ="submit" value="提交" >

</form>
</body>
</html>
复制代码

 

updatahuiyishixinxi.jsp

复制代码
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style> 
body{text-align:center} 
</style>
</head>
<body>
<form action="/Test4/r2?method=updatahuiyishixinxi"method="post" onsubmit="return check();">
                    <h1>请输入信息</h1>
                    1.会议室编号<input type="text" name="MeetroomId"> <br/>
                    2.会议室名称<input type="text" name="MeetroomName"> <br/>
                    3.会议室地址<input type="text" name="Address"> <br/>
                    4.可用状态<input type="text" name="ReadyState"> <br/>
                    5.目前状态<input type="text" name="Status"> <br/>
                    6.容纳人数<input type="text" name="Capacity"> <br/>
                    <input type ="submit" value="提交" >

</form>
</body>
</html>
复制代码

 

yuyuehuiyi.jsp

复制代码
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style> 
body{text-align:center} 
</style>
</head>
<body>
<form action="/Test4/r2?method=yuyuehuiyi"method="post" onsubmit="return check();">
                    <h1>请输入信息</h1>
                    1.会议ID<input type="text" name="MeetingID"> <br/>
                    2.会议主题<input type="text" name="MeetingName"> <br/>
                    3.主要内容<input type="text" name="MeetingContent"> <br/>
                    4.会议开始时间<input type="text" name="MeetingBegin"> <br/>
                    5.会议结束时间<input type="text" name="MeetingEnd"> <br/>
                    6.参会人数<input type="text" name="MeetingNum"> <br/>
                    7.参会人员<input type="text" name="Participants"> <br/>
                    8.预约会议室编号<input type="text" name="MeetroomId"> <br/>
                    9.申请人编号<input type="text" name="UserID"> <br/>
                    <input type ="submit" value="提交" >

</form>
</body>
</html>
复制代码

 

zhiyuanchakanhuiyishixinxi.jsp

复制代码
<%@page import="java.util.*"%>
<%@page import="bean.*"%>
<%@page import="dao.*"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style> 
body{text-align:center} 
</style>
</head>
<body>
<div align="center">
        <h1 style="color: black;">会议室信息</h1>
        <table class="tb" border="">
        <tr>
            <tr>
                <th>会议室编号</th>
                <th>会议室名称</th>
                <th>会议室地址</th>
                <th>可用状态</th> 
                <th>目前状态</th> 
                <th>容纳人数</th> 
            </tr>
            <%List<huiyishixinxi> list=(List<huiyishixinxi>)request.getAttribute("kc");
            //String s="sd";
            //request.getSession().setAttribute("ss",s);
                for(huiyishixinxi kc : list){
             %>
             <tr>
                <td><%=kc.getMeetroomId() %></td>
                <td><%=kc.getMeetroomName() %></td>
                <td><%=kc.getAddress() %></td>
                <td><%=kc.getReadyState() %></td>
                <td><%=kc.getStatus() %></td>
                <td><%=kc.getCapacity() %></td>
                
              </tr>
             
             <%      
                }
            %>
                
        </table>
        <!--  
                <input type="hidden" name="ID" id="ID" value="${kc[0]}">
           
           <td><input type="hidden" name="name" id="name" value="${kc[1]}"></td>
         <tr>
           <td><input type="hidden" name="renshu" id="renshu" value="${kc[2]}"></td>
           </tr>
           <td><input type="hidden" name="jiaoshi" id="jiaoshi" value="${kc[4]}"></td>
           -->
</body>
</html>
复制代码

 

zhiyuandenglu.jsp

复制代码
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style> 
body{text-align:center} 
</style>
</head>
<body>
            <p>请选择所需功能</p>
            <form action="/Test4/r2?method=" method="post" onsubmit="return check();">
                <p>
                    <input type="submit" value="浏览个人信息">
                </p>
            </form>    
                
            <a href="zhiyuanxiugaimima.jsp">
            <button>修改个人密码</button>
            </a>    
            <br>
            <br>    
            <form action="/Test4/r2?method=zhiyuanselecthuiyishixinxi" method="post" onsubmit="return check();">
                <p>
                    <input type="submit" value="浏览会议室信息">
                </p>
            </form>    
            <form action="/Test4/r2?method=chanxunselecthuiyishixinxi" method="post" onsubmit="return check();">
                <p>
                    <input type="submit" value="查询会议室信息">
                </p>
            </form>        
            <a href="yuyuehuiyi.jsp">
            <button>预约会议</button>
            </a>    
</body>
</html>
复制代码

 

zhiyuanxiugaimima.jsp

复制代码
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style> 
body{text-align:center} 
</style>
</head>
<body>
<form action="/Test4/r2?method=zhiyuanxiugaimima"method="post" onsubmit="return check();">
                    <h1>请输入信息</h1>
                    1.旧密码<input type="text" name="password1"> <br/>
                    2.新密码<input type="text" name="password2"> <br/>
                    <input type ="submit" value="提交" >

</form>
</body>
</html>
复制代码

 

posted @   李迎辉  阅读(48)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示