(这里的代码有点多不过都不是特别复杂,慢慢看,O(∩_∩)O哈哈~)

LoginServlet.java

package cn.javaee.controller;import java.io.IOException;
import java.net.URLEncoder;import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import cn.javaee.model.Customer;
import cn.javaee.model.CustomerList;/*** * @see    验证用户登录* @author wangbin* @time 2017年11月18日 下午3:02:31*/
@WebServlet("/LoginServlet")
public class LoginServlet extends HttpServlet {private static final long serialVersionUID = 1L;/*** @see HttpServlet#HttpServlet()*/public LoginServlet() {super();// TODO Auto-generated constructor stub}/*** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)*/protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {// TODO Auto-generated method stubresponse.setCharacterEncoding("GBK");//获取表单提交的三个属性//分别是 ”用户名“,”密码“,”记住账号"String username = request.getParameter("username");String password = request.getParameter("password");String rememberusername =request.getParameter("rememberusername");//将获取的用户名和密码通过 new Customer(String username,String password)构造方法转换为一个Customer类Customer customer = new Customer(username,password);if(username!= null && password!=null){CustomerList customerList = new CustomerList();//验证用户提交的用户是否存在//通过判断是否能通过用户提交的用户名从用户列表中获取一个非空的Customer来判断该用户是否存在Customer curCustomer = customerList.getCustomerByName(username);//若不存在,则返回“incorrect"if(curCustomer == null){response.getWriter().print("incorrect");}else{//若存在该用户,则验证密码是否正确if(curCustomer.equals(customer)){//若密码正确,则成功登录//添加一个cookie用于存放用户的用户名Cookie nameCookie = new Cookie("username",URLEncoder.encode(customer.getUserName(),"UTF-8"));nameCookie.setMaxAge(60*60*24);response.addCookie(nameCookie);//若用户选择“记住账号",则添加一个cookie用于保留用户的选择if(rememberusername.equals("true")){Cookie myCookie=new Cookie("rememberName",URLEncoder.encode(customer.getUserName(),"UTF-8"));myCookie.setMaxAge(60*60*24);response.addCookie(myCookie);}else{//若用户没有选择“记住账号",则删除用于保留用户选择的cookieCookie[] cookies = request.getCookies();if(cookies != null && cookies.length>0){Cookie cookie = null;for(int i=0;i<cookies.length;i++){cookie = cookies[i];if(cookie.getName().equals("rememberName")){cookie.setMaxAge(0);response.addCookie(cookie);break;}}}}if(curCustomer.getStatus() == 0){//若该账号是普通用户,则跳转到普通用户页面response.getWriter().print("customer_index.jsp");}else{//若该账号是管理员,则跳转到管理员页面response.getWriter().print("admin_index.jsp");}}else{response.getWriter().print("incorrect");}}}}/*** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)*/protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {// TODO Auto-generated method stubdoGet(request, response);}}

SignUpServlet.java

package cn.javaee.controller;import java.io.IOException;
import java.sql.SQLException;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 cn.javaee.model.Customer;
import cn.javaee.model.CustomerList;/*** * @see   用户注册* @author wangbin* @time 2017年11月18日 下午3:10:54*/
@WebServlet("/SignUpServlet")
public class SignUpServlet extends HttpServlet {private static final long serialVersionUID = 1L;/*** @see HttpServlet#HttpServlet()*/public SignUpServlet() {super();// TODO Auto-generated constructor stub}/*** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)*/protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {// TODO Auto-generated method stub//获取用户想要注册的用户名和密码String userNameSignUp = request.getParameter("userNameSignUp");String passwordSignUp = request.getParameter("passwordSignUp");if ((userNameSignUp != null) && (passwordSignUp != null)) {//判断该用户名是否已经被注册CustomerList customerList = new CustomerList();Customer customer = customerList.getCustomerByName(userNameSignUp);if(customer == null){//若该用户名尚未被注册,则添加该用户customer =new Customer(userNameSignUp,passwordSignUp);customer.setStatus(0);customer.setUserId(String.valueOf(System.currentTimeMillis()));customer.setSchedule(null);//将用户输入的信息转为相应的Customer类try {customerList.addCustomer(customer);} catch (ClassNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();}response.getWriter().print("success");}else{//若已经被注册,则返回一个错误提示response.getWriter().print("error");}} else {response.getWriter().print("there is an error!");}}/*** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)*/protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {// TODO Auto-generated method stubdoGet(request, response);}}

Customer.java

/*** */
package cn.javaee.model;/** * @see    Customer类,表示普通用户* @author wangbin* @time 2017年11月15日 下午1:26:10*/
public class Customer extends User{/*** schedule Schedule类,用于存储该用户的所有日程*/private Schedule schedule;/*** 默认的构造函数*/public Customer(){}/*** * @param cutomerId  用户ID*/public Customer(String cutomerId){schedule = new Schedule(cutomerId);this.setUserId(cutomerId);}/*** * @param userName  用户名* @param password  用户密码*/public Customer(String userName,String password){super(userName,password);}public Schedule getSchedule() {return schedule;}public void setSchedule(Schedule schedule) {this.schedule = schedule;}/* * @see  判断两个普通用户是否相同* @author wangbin* @time 2017年11月15日 下午1:27:10* @reutrn 若两者相同则返回true,否则返回false*/@Overridepublic boolean equals(Object obj) {// TODO Auto-generated method stubif(obj != null){if(obj instanceof Customer){if((this.getUserName().equals(((Customer) obj).getUserName()) && this.getPassword().equals(((Customer) obj).getPassword()))){return true;}}}return false;}
}

User.java

/*** */
package cn.javaee.model;/*** @see    User类,表示用户* @author wangbin* @time 2017年11月15日 下午12:41:06*/
public class User {/*** userName 用户名* userId   用户ID* password 用户密码* status   用户类别,0为普通用户,1为管理员*/private String userName;private String userId;private String password;private int status;public User(){}public User(String userName,String password){this.userName = userName;this.password = password;}public String getUserName() {return userName;}public void setUserName(String userName) {this.userName = userName;}public String getUserId() {return userId;}public void setUserId(String userId) {this.userId = userId;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}public int getStatus() {return status;}public void setStatus(int status) {this.status = status;}/*** @see 判断两个用户是否相同* @author wangbin* @time 2017年11月15日 下午12:45:25* @return 若两个userId相同则返回true,否则返回false*/@Overridepublic boolean equals(Object obj) {// TODO Auto-generated method stubif(obj != null){if(obj instanceof User){if(this.userId.equals(((User) obj).getUserId())){return true;}}}return false;}
}

CustomerList.java

/*** */
package cn.javaee.model;import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;/*** @see    CustomerList类,用于管理所有的普通用户信息* @author wangbin* @time 2017年11月15日 下午1:30:56*/
public class CustomerList {/*** 用于存储所有的用户信息*/private ArrayList<Customer> customerList;/*** 从user表中将所有的用户信息转为Customer类,添加到customerList中* */public CustomerList(){Connection conn=null;customerList = new ArrayList<Customer>();try {conn = AccessJDBCUtil.getAccessDBConnection();Statement stmt = conn.createStatement();String queryString = "select * from user ";ResultSet rs = stmt.executeQuery(queryString);while (rs.next()) {Customer customer = new Customer(rs.getString("userId"));customer.setUserId(rs.getString("userId"));customer.setUserName(rs.getString("userName"));customer.setStatus(rs.getInt("status"));customer.setPassword(rs.getString("password"));customerList.add(customer);}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{if(conn != null){try {conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}}public ArrayList<Customer> getCustomerList() {return customerList;}public void setCustomerList(ArrayList<Customer> customerList) {this.customerList = customerList;}/*** * @see    通过普通用户名获取普通用户* @author wangbin* @time 2017年11月15日 下午1:35:26* @param name 待获取的用户的名字* @return 若存在名字为name的用户,则返回该用户,否则返回空*/public Customer getCustomerByName(String name){for(Customer customer: customerList){if(customer.getUserName().equals(name)){return customer;}}return null;}/*** * @see    通过普通用户的用户id获取普通用户* @author wangbin* @time 2017年11月15日 下午1:37:31* @param id 待获取的用户的ID* @return 若存在ID为id的用户,则返回该用户,否则返回空*/public Customer getCustomerById(String id){for(Customer customer: customerList){if(customer.getUserId().equals(id)){return customer;}}return null;}/*** * @see   添加一个普通用户* @author wangbin* @time 2017年11月15日 下午1:39:20* @param customer 待添加的用户*/public boolean addCustomer(Customer customer) throws ClassNotFoundException{String userName = customer.getUserName();String password = customer.getPassword();String userId = String.valueOf(System.currentTimeMillis());int status = 0;Connection conn=null;try {conn = AccessJDBCUtil.getAccessDBConnection();Statement stmt = conn.createStatement();String sql = "insert into user (userName,password,userId,status) values('" + userName + "','"+ password + "','" + userId+"',"+status + ");";int result = stmt.executeUpdate(sql);if (result != -1) {customerList.add(customer);return true;} else {return false;}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();} finally {if(conn != null){try {conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}return false;}/*** * @see    删除一个用户* @author wangbin* @time 2017年11月15日 下午1:40:58* @param id 待删除用户的ID* @return 若存在该用户且成功删除,则返回true,否则返回false;*/public boolean deleteCustomer(String id){Customer customer = getCustomerById(id);if(customer != null){customerList.remove(customer);return true;}return false;}/*** * @see    修改一个普通用户的信息* @author wangbin* @time 2017年11月15日 下午1:43:07* @param id 待修改用户的ID* @return  若存在该用户且修改信息成功,则返回true,否则返回false*/public boolean modifyCustomer(String id){for(Customer customer: customerList){if(customer.getUserId().equals(id)){//进行相关修改操作return true;}}return false;}/* * @see    判断两个CustomerList是否相同* @author wangbin* @time   2017年11月15日 下午1:31:56* @return 若两者相同,则返回true,否则返回false*/@Overridepublic boolean equals(Object obj) {// TODO Auto-generated method stubif(obj != null){if(obj instanceof CustomerList){if(this.getCustomerList().equals(((CustomerList) obj).getCustomerList())){return true;}}}return false;}
}

Schedule.java

/*** */
package cn.javaee.model;import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;/*** @see    Schedule类,用于管理用户的所有事宜(ScheduleItem)* @author wangbin* @time 2017年11月15日 下午1:06:34*/
public class Schedule {/*** customerId 该日程安排所属的用户ID* schedule   该日程安排所包含的所有事宜(ScheduleItem)*/private String customerId;private ArrayList<ScheduleItem> schedule;public Schedule(){}/*** 将schedule_item表中的所有信息转为ScheduleItem,添加到schedule中* @param customerId  用户ID*/public Schedule(String customerId){Connection conn=null;schedule = new ArrayList<ScheduleItem>();try {conn = AccessJDBCUtil.getAccessDBConnection();Statement stmt = conn.createStatement();String queryString = "select * from schedule_item where customerId = "+customerId;ResultSet rs = stmt.executeQuery(queryString);while (rs.next()) {ScheduleItem item = new ScheduleItem();item.setId(rs.getString("id"));item.setCustomerId(rs.getString("customerId"));item.setTitle(rs.getString("content"));//数据表中的time选项对应一个事宜的开始时间String start = rs.getString("time");//数据表中的end选项对应一个事宜的结束时间String end = rs.getString("end");String remindTime = rs.getString("remindTime");item.setEnd(end);item.setRemindTime(remindTime);//因为数据表中存放时间的格式是时间戳,但是客户端显示的时间是:2017-11-12 14:25:25//所以需要将时间戳转为客户端想要的时间格式SimpleDateFormat format =  new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  //数据表中存放的时间戳长度是10为,单位是秒//format(timestamp)函数中的时间戳单位是毫秒//所以要给从数据表中获取的时间加上3个0String startTimeString = format.format(Long.parseLong(start+"000"));String endTimeString = format.format(Long.parseLong(end+"000"));item.setStart(startTimeString);item.setEnd(endTimeString);//数据表中是用state项来表示一个事宜的状态//ScheduleItem是用color来表示一个事宜的状态//所以要将state值转为对应的颜色int state = rs.getInt("state");String color=null;if(state == 1){color = "yellow";}else if(state == 2){color = "red";}else if(state == 3){color = "green";}else{color = "gray";}item.setColor(color);schedule.add(item);}//更新返回的数据//就是判断哪些事宜已经进入了提醒时间,修改那些进入提醒时间的事宜状态//但是并没有修改数据库中这些事宜的值updateSchedule(schedule);//修改数据库中这些事宜的值updateData(schedule);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{if(conn != null){try {conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}}public String getCustomerId() {return customerId;}public void setCustomerId(String customerId) {this.customerId = customerId;}public ArrayList<ScheduleItem> getSchedule() {return schedule;}public void setSchedule(ArrayList<ScheduleItem> schedule) {this.schedule = schedule;}/*** * @see    通过ScheduleItem的id来获取ScheduleItem* @author wangbin* @time 2017年11月15日 下午1:13:30* @param itemId ScheduleItem的id* @return  若存在则返回该ScheduleItem,否则返回空*/public ScheduleItem getScheduleItem(String itemId){//遍历该Schedule中的所有ScheduleItem//若存在一项的id与itemId相同则返回该项for(ScheduleItem item: schedule){if(item.getId().equals(itemId)){return item;}}return null;}/*** * @see    添加一条事宜* @author wangbin* @time 2017年11月15日 下午1:15:28* @param item 待添加的事宜*/public boolean addScheduleItem(ScheduleItem item){//若该项事宜不为空,则正常添加String id = item.getId();String cutomerId = item.getCustomerId();String title = item.getTitle();String start = item.getStart();String end = item.getEnd();String remindTime = item.getRemindTime();Connection conn=null;try {conn = AccessJDBCUtil.getAccessDBConnection();Statement stmt = conn.createStatement();String sql = "insert into schedule_item (id,customerId,content,time,remindTime,state,end) values('" + id + "','"+ cutomerId + "','" + title+"','"+start +"','"+remindTime+"',1,'"+end+"');";int result = stmt.executeUpdate(sql);if (result != -1) {schedule.add(item);return true;} else {return false;}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();} finally {if(conn != null){try {conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}return false;}/*** * @see    删除一条事宜* @author wangbin* @time 2017年11月15日 下午1:20:12* @param itemId 待删除事宜的ID* @return 若成功删除则返回true,否则返回false;*/public boolean deleteScheduleItem(String itemId){Connection conn=null;try {conn = AccessJDBCUtil.getAccessDBConnection();Statement stmt = conn.createStatement();String sql = "delete from schedule_item  where id = "+itemId;int result = stmt.executeUpdate(sql);if(result != -1){return true;}}catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();} finally{if(conn != null){try {conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}return false;}/*** * @see    修改某项事宜* @author wangbin* @time 2017年11月15日 下午1:25:03* @param itemId  待修改事宜的id* @return 若修改成功则返回true,否则返回false;*/public boolean modifyScheduleItem(String itemId,String title,String start,String end,String remindTime){Connection conn=null;try {conn = AccessJDBCUtil.getAccessDBConnection();Statement stmt = conn.createStatement();String sql = "update schedule_item set content = '"+title+"',time='"+start+"',end='"+end+"',remindTime='"+remindTime+"' where id = "+itemId;stmt.executeUpdate(sql);return true;}catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();} finally{if(conn != null){try {conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}return false;}/*** * @see  完成一条事宜* @author wangbin* @time 2017年11月18日 下午3:27:20* @param itemId  被完成的事宜的ID* @return*/public boolean changeItemState(String itemId){Connection conn=null;try {conn = AccessJDBCUtil.getAccessDBConnection();Statement stmt = conn.createStatement();//将该事宜的state值改为3,即意味着完成了一条事宜String sql = "update schedule_item set state = 3  where id = "+itemId;int result = stmt.executeUpdate(sql);if(result != -1){return true;}}catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();} finally{if(conn != null){try {conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}return false;}/*** * @see    更新事宜的状态* @author wangbin* @time 2017年11月18日 下午3:28:27* @param schedule*/public void updateSchedule(ArrayList<ScheduleItem> schedule){//遍历所有的事宜,看哪些事宜需要修改for(ScheduleItem item: schedule){long now  = Long.parseLong(String.valueOf(System.currentTimeMillis()));String start = item.getStart();String end = item.getEnd();String remindTime =item.getRemindTime();SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");Date startDate = null;Date endDate = null;try {startDate = simpleDateFormat.parse(start);endDate = simpleDateFormat.parse(end);} catch (ParseException e) {// TODO Auto-generated catch blocke.printStackTrace();}long startTimeStamp = startDate.getTime();long endTimeStamp = endDate.getTime();long dueRemindTime = startTimeStamp-Long.parseLong(remindTime);if(now>dueRemindTime && now<endTimeStamp && !item.getColor().equals("green") && !item.getColor().equals("gray")){//若当前时间大于用户设置的事宜开始时间减去提醒时间//则意味着该事宜已经进入了提醒状态item.setColor("red");}else if(now >endTimeStamp && !item.getColor().equals("green")){//若当前时间大于用户设置的事宜的结束时间,且用户没有完成该事宜//则意味着该事宜进入了"未完成"状态item.setColor("gray");}}} /*** * @see   更新数据表中需要修改的事宜* 该方法同上,只是这个方法是修改数据表中的数据* @author wangbin* @time 2017年11月18日 下午3:31:01* @param schedule*/public void updateData(ArrayList<ScheduleItem> schedule){Connection conn=null;try {conn = AccessJDBCUtil.getAccessDBConnection();Statement stmt = conn.createStatement();for(ScheduleItem item: schedule){long now  = Long.parseLong(String.valueOf(System.currentTimeMillis()));String start = item.getStart();String end = item.getEnd();String remindTime =item.getRemindTime();SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");Date startDate = null;Date endDate = null;try {startDate = simpleDateFormat.parse(start);endDate = simpleDateFormat.parse(end);} catch (ParseException e) {// TODO Auto-generated catch blocke.printStackTrace();}long startTimeStamp = startDate.getTime();long endTimeStamp = endDate.getTime();long dueRemindTime = startTimeStamp-Long.parseLong(remindTime);String sql = null;if(now>dueRemindTime && now<endTimeStamp && !item.getColor().equals("green") && !item.getColor().equals("gray")){sql = "update schedule_item set state = 2 where id = "+item.getId();stmt.executeUpdate(sql);}else if(now >endTimeStamp && !item.getColor().equals("green")){sql = "update schedule_item set state = 4 where id = "+item.getId();stmt.executeUpdate(sql);}}}catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();} finally{if(conn != null){try {conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}} /* * @see    判断两个Schedule是否相同* @author wangbin* @time   2017年11月15日 下午1:09:34* @return 若两者相同则返回true,否则返回false;*/@Overridepublic boolean equals(Object obj) {// TODO Auto-generated method stubif(obj != null){if(obj instanceof Schedule){if(this.getCustomerId().equals(((Schedule) obj).getCustomerId()) && this.getSchedule().equals(((Schedule) obj).getSchedule())){return true;}}}return false;}
}

ScheduleItem.java

/*** */
package cn.javaee.model;/*** @see    ScheduleItem类,表示日程安排中的事宜* @author wangbin* @time 2017年11月15日 下午12:48:04*/
public class ScheduleItem {/*** id         事宜ID* customerId 该事宜所属的用户ID* content    该事宜的内容* time         该事宜设置的时间* remindTime 该事宜的提醒时间(如在事宜设置的时间前30分钟或者一小时,该事宜进入提醒时间状态)* color      该事宜的状态* 未进入提醒时间的待完成事宜用 黄色表示* 进入提醒时间的待完成事宜用     红色表示* 已完成的事宜用                 绿色表示* 未完成的事宜用                         灰色表示   */private String id;private String customerId;private String title;private String start;private String end;private String color;private String remindTime;public ScheduleItem(){}public ScheduleItem(String id,String title,String start,String end,String color,String remindTime){this.id = id;this.title = title;this.start = start;this.end = end;this.color = color;this.remindTime = remindTime;}public String getId() {return id;}public void setId(String id) {this.id = id;}public String getCustomerId() {return customerId;}public void setCustomerId(String customerId) {this.customerId = customerId;}public String getTitle() {return title;}public void setTitle(String title) {this.title = title;}public String getStart() {return start;}public void setStart(String start) {this.start = start;}public String getEnd() {return end;}public void setEnd(String end) {this.end = end;}public String getColor() {return color;}public void setColor(String color) {this.color = color;}public String getRemindTime() {return remindTime;}public void setRemindTime(String remindTime) {this.remindTime = remindTime;}
/* (non-Javadoc)* @see java.lang.Object#toString()*/
@Override
public String toString() {// TODO Auto-generated method stubreturn "{id:'"+this.id+"',title:'"+this.title+"',start:'"+this.start+"',end:'"+this.end+"',color:'"+this.color+"',remindTime'"+this.remindTime+"'}";
}/*** @see 判断两个事宜是否相同* @author wangbin* @time  2017年11月15日 下午13:02:14* @return 若两者相同则返回true,否则返回false*/@Overridepublic boolean equals(Object obj) {// TODO Auto-generated method stubif(obj != null){if(obj instanceof ScheduleItem){if(this.getId().equals(((ScheduleItem) obj).getId())){return true;}}}return false;}
}

AccessJDBCUtil.java

package cn.javaee.model;/*** @see    AccessJDBCUtil工具类,用于处理数据库连接* @author wangbin* @time 2017年11月15日 下午3:16:19*/
import java.sql.*;public class AccessJDBCUtil {//注册jdbc驱动static {try {Class.forName("com.mysql.jdbc.Driver");} catch(ClassNotFoundException e) {System.err.println("JdbcOdbc Bridge Driver not found!");}}/*** * @see    建立数据库连接,连接的数据库名为marhong,用户名、密码均为root* @author wangbin* @time 2017年11月15日 下午3:17:11* @return  * @throws SQLException*/public static java.sql.Connection getAccessDBConnection() throws SQLException {String databaseURL = "jdbc:mysql://localhost/marhong?useUnicode=true&characterEncoding=utf-8";return DriverManager.getConnection(databaseURL, "root", "root");}
}

这里我用的数据库是mysql,上面用到的数据库名为marhong,库中有两个表user、schedule_item,两个表的结构如下图所示:

user表

schedule_item表

具体的代码功能就不再解释了,因为在java doc中已经说的很详细了。如果有疑惑可以一起讨论哈。

基于FullCalendar插件的简单个人日程安排系统(3)相关推荐

  1. php周计划表_PHPOA日程安排系统,建立井然有序的工作计划

    原标题:PHPOA日程安排系统,建立井然有序的工作计划 生活需要仪式感,工作也同样需要!生活需要精打细算,工作也需要做出每日计划.每天被周而复始的工作压得透不过气来,那一定是计划没提前做好.如何让工作 ...

  2. 基于FullCalendar插件的个人日程安排系统(4)

    这一篇开始要用到FullCalendar插件,由于我自己也是头一次用,也不是很了解,所以只能简单介绍一下,大家可以一起讨论. 效果图 customer_index.jsp <%@ page la ...

  3. FullCalendar 一: 日程安排FullCalendar

    FullCalendar是一款基于jQuery的日历插件,适用于各种日程安排.工作计划等场景,您可以很方便的查看查看待办事项,标记重要事项以及绑定点击和拖动事件,能快速的整合到您的项目中,本文将简单介 ...

  4. FullCalendar日历插件的简单使用(版本4.2.0)

    最近开的一个项目,涉及到了日历日程安排的功能,所以选用了一个免费的日历插件:FullCalendar 1.首先去官网将官方的demo下载下来,通过官方的demo进行一个初步的了解,下面正式开始 PS: ...

  5. vue日程安排_使用Fullcalendar管理时间计划调度安排

    原标题:使用Fullcalendar管理时间计划调度安排 Fullcalendar可以很好的管理日程安排事件,可以管理时间和任务调度,比如日常值班岗位安排.举办活动会议议程安排.项目行动安排.车间劳动 ...

  6. Vue中使用Fullcalendar日历开发日程安排

    效果图: 官方文档地址:Vue Component - Docs | FullCalendar 1.安装与FullCalendar相关的依赖项 npm install --save @fullcale ...

  7. python项目源码 日程管理_基于fullcalendar制作的日程管理小demo

    一.项目地址: 二.项目功能概述: 该项目是基于fullcalendar而制作的日程管理,fullcalendar是一个基于jquery的日历插件,在该项目中,我们可以在日历上编辑我们的日程,并将日程 ...

  8. 天纵智能软件快速开发平台日程安排插件

    定义 日程安排视图类模块用来构建工作计划式的模块,视图展示每个时间点的任务内容,用于时间安排类功能,如工作计划.日程安排等. 功能描述 时尚简约界面风格,可以切换日.周.月查看日程安排.纯JS构造,操 ...

  9. 利用FullCalendar做简单的日程管理,以及后台动态更新数据出现的问题。

    第一:总体效果. 1.初始化日历: 2.点击某一天可以添加日程: 3.点击已添加的日程可以进行修改.删除.分享: 4.点击分享,可以选择系统内的人员进行日程的分享: 5.如果是上级,可以通过日历左上角 ...

最新文章

  1. R构建Kmeans聚类模型
  2. 为什么你喜欢的女生不喜欢你
  3. oracle v$access执行很慢,Oracle bug之v$access
  4. Appium+RobotFrameWork测试环境搭建
  5. java builder.parse_JAVA之DocumentBuilder生成解析XML
  6. 最安全的js类型检测
  7. odoo12 日历模块_日历-ODOO ERP界面布局与操作说明|ODOO 13教程
  8. 临键锁如何实现幻读_如何用Redis实现分布式锁?
  9. 文本处理算法_python 文本处理
  10. .net 数字转汉字_收藏!小学生汉字拼音学习工具。
  11. JavaWeb_EL表达式存储数据及获得项目路径
  12. 设计界面说—探讨设计艺术
  13. 南阳oj-----找球号(一)(set)
  14. postman 生成html测试报告
  15. ER Studio 使用笔记
  16. RISC-V嵌入式开发入门篇2:RISC-V汇编语言程序设计(上)
  17. Google云游戏平台Stadia好不好玩?第一波实测火热出炉!
  18. utools01-分享一个极简的多功能高效率工作神器
  19. 分析复联系列电影台词,看看每个英雄说得最多的词是什么
  20. 2D游戏的战争迷雾实现方式

热门文章

  1. 基于Vue.js+Go的Web3D宇宙空间数据可视化系统 设计报告+前后端源码及数据
  2. 做电商数据分析可视化,这个国产BI软件很香
  3. Vue中...(三个点)的意思及作用(扩展运算符)
  4. 各大品牌笔记本功能键(Fn)说明
  5. 这款工具可以轻松让 Matplotlib 绘制精美漂亮的表格
  6. Unity LeanTouch 点击按下抬起事件以及LeanInfoText组件的使用
  7. hqs-popup弹窗实现多选(uni-app)
  8. 【Service】bindService:绑定本地服务和远程服务示例
  9. JAVA Instrumentation
  10. MySQL学习之路(5) - 数据库事务、视图、触发器、函数