├── web ├── META-INF │ └── context.xml ├── images │ ├── top.gif │ ├── top1.jpg │ └── bottom.jpg ├── WEB-INF │ ├── lib │ │ └── mysql-connector-java-5.1.13-bin.jar │ └── web.xml ├── main │ ├── bottom.jsp │ ├── left.jsp │ ├── top.jsp │ ├── middle.jsp │ └── main.jsp ├── fileManager │ ├── fileDown.jsp │ └── fileUp.jsp ├── dateManager │ ├── deleteDate.jsp │ ├── addDate.jsp │ ├── updateDate.jsp │ └── lookDate.jsp ├── friendManager │ ├── updateFriend.jsp │ ├── deleteFriend.jsp │ ├── lookFriend.jsp │ ├── updateFriendMessage.jsp │ └── addFriend.jsp ├── lookMessage │ ├── updatePassword.jsp │ ├── lookMessage.jsp │ └── updateMessage.jsp ├── login.jsp └── register │ └── register.jsp ├── screenshot ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png └── 6.png ├── src ├── loginRegister │ ├── LoginBean.java │ ├── LoginServlet.java │ └── RegisterServlet.java ├── friendManager │ ├── UpdateFriendBean.java │ ├── LookFriendBean.java │ ├── LookFriendServlet.java │ ├── UpdateFriendServlet.java │ ├── DeleteFriendServlet.java │ ├── UpdateFriendMessageServlet.java │ └── AddFriendServlet.java ├── dateManager │ ├── LookDateBean.java │ ├── LookDateServlet.java │ ├── DeleteDateServlet.java │ ├── UpdateDateServlet.java │ └── AddDateServlet.java ├── lookMessage │ ├── LookMessageServlet.java │ ├── LookMessageBean.java │ ├── UpdatePasswordServlet.java │ └── UpdateMessageServlet.java └── fileManager │ └── FileUpServlet.java ├── .gitignore └── README.md /web/META-INF/context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /screenshot/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No204PersonalInformationManagementSystem/HEAD/screenshot/1.png -------------------------------------------------------------------------------- /screenshot/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No204PersonalInformationManagementSystem/HEAD/screenshot/2.png -------------------------------------------------------------------------------- /screenshot/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No204PersonalInformationManagementSystem/HEAD/screenshot/3.png -------------------------------------------------------------------------------- /screenshot/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No204PersonalInformationManagementSystem/HEAD/screenshot/4.png -------------------------------------------------------------------------------- /screenshot/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No204PersonalInformationManagementSystem/HEAD/screenshot/5.png -------------------------------------------------------------------------------- /screenshot/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No204PersonalInformationManagementSystem/HEAD/screenshot/6.png -------------------------------------------------------------------------------- /web/images/top.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No204PersonalInformationManagementSystem/HEAD/web/images/top.gif -------------------------------------------------------------------------------- /web/images/top1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No204PersonalInformationManagementSystem/HEAD/web/images/top1.jpg -------------------------------------------------------------------------------- /web/images/bottom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No204PersonalInformationManagementSystem/HEAD/web/images/bottom.jpg -------------------------------------------------------------------------------- /web/WEB-INF/lib/mysql-connector-java-5.1.13-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No204PersonalInformationManagementSystem/HEAD/web/WEB-INF/lib/mysql-connector-java-5.1.13-bin.jar -------------------------------------------------------------------------------- /web/main/bottom.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 8 | JSP Page 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /web/fileManager/fileDown.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : fileDown 3 | Created on : 2012-3-21, 22:28:20 4 | Author : Administrator 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | JSP Page 13 | 14 | 15 |

请编码实现本功能!

16 | 17 | 18 | -------------------------------------------------------------------------------- /src/loginRegister/LoginBean.java: -------------------------------------------------------------------------------- 1 | 2 | package loginRegister; 3 | 4 | public class LoginBean { 5 | private String userName; 6 | private String password; 7 | public LoginBean(){ 8 | } 9 | public String getUserName() { 10 | return userName; 11 | } 12 | public void setUserName(String userName) { 13 | this.userName = userName; 14 | } 15 | public String getPassword() { 16 | return password; 17 | } 18 | public void setPassword(String password) { 19 | this.password = password; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/friendManager/UpdateFriendBean.java: -------------------------------------------------------------------------------- 1 | package friendManager; 2 | 3 | /* 4 | * To change this template, choose Tools | Templates 5 | * and open the template in the editor. 6 | */ 7 | 8 | /** 9 | * 10 | * @author Administrator 11 | */ 12 | public class UpdateFriendBean { 13 | private String name; 14 | 15 | /** 16 | * @return the name 17 | */ 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | /** 23 | * @param name the name to set 24 | */ 25 | public void setName(String name) { 26 | this.name = name; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/dateManager/LookDateBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package dateManager; 7 | 8 | /** 9 | * 10 | * @author abc 11 | */ 12 | public class LookDateBean { 13 | private String date; 14 | private String thing; 15 | public LookDateBean(){ 16 | } 17 | public String getDate() { 18 | return date; 19 | } 20 | public void setDate(String date) { 21 | this.date = date; 22 | } 23 | public String getThing() { 24 | return thing; 25 | } 26 | 27 | /** 28 | * @param thing the thing to set 29 | */ 30 | public void setThing(String thing) { 31 | this.thing = thing; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /web/main/left.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 4 | 5 | 6 | 7 | 8 | 9 | 子窗口左边部分 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 22 | 23 |
15 | 清华大学出版社 16 |
20 | 风景 21 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Build Tools 3 | 4 | .gradle 5 | /build/ 6 | !gradle/wrapper/gradle-wrapper.jar 7 | 8 | target/ 9 | !.mvn/wrapper/maven-wrapper.jar 10 | 11 | out/ 12 | 13 | ###################################################################### 14 | # IDE 15 | 16 | ### STS ### 17 | .apt_generated 18 | .classpath 19 | .factorypath 20 | .project 21 | .settings 22 | .springBeans 23 | 24 | ### IntelliJ IDEA ### 25 | .idea 26 | *.iws 27 | *.iml 28 | *.ipr 29 | 30 | ### NetBeans ### 31 | nbproject/private/ 32 | build/* 33 | nbbuild/ 34 | dist/ 35 | nbdist/ 36 | .nb-gradle/ 37 | 38 | ###################################################################### 39 | # Others 40 | *.log 41 | *.xml.versionsBackup 42 | *.swp 43 | 44 | !*/build/*.java 45 | !*/build/*.html 46 | !*/build/*.xml 47 | -------------------------------------------------------------------------------- /web/main/top.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 4 | 5 | 6 | 7 | 8 | 9 | top页面 10 | 16 | 17 | 18 | 19 | 20 | 23 | 26 | 27 |
21 | 校训 22 | 24 |

欢迎使用个人信息管理平台

25 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

204.个人信息管理系统

2 | 3 | - 完整代码获取地址:从戎源码网 ([https://armycodes.com/](https://armycodes.com/)) 4 | - 技术探讨、资料分享,请加QQ群:692619798 5 | - 作者微信:19941326836 QQ:952045282 6 | - 承接计算机毕业设计、Java毕业设计、Python毕业设计、深度学习、机器学习 7 | - 选题+开题报告+任务书+程序定制+安装调试+论文+答辩ppt 一条龙服务 8 | - 所有选题地址 ([https://github.com/YuLin-Coder/AllProjectCatalog](https://github.com/YuLin-Coder/AllProjectCatalog)) 9 | 10 | ## 项目介绍 11 | 基于java+jsp的个人信息管理系统:前端 jsp,后端 servlet、jdbc;集成个人信息管理、通讯录管理、日程安排管理等功能于一体的系统。 12 | 13 | ## 功能介绍 14 | 15 | - 基本功能:登录,注册,退出 16 | - 个人信息管理:个人信息查看,修改,密码修改 17 | - 通讯录管理:通讯录信息的增删改查 18 | - 日程安排管理:日程信息的增删改查 19 | 20 | ## 环境 21 | 22 | - IntelliJ IDEA 2021.3 23 | 24 | - Mysql 5.7.26 25 | 26 | - Tomcat 7.0.73 27 | 28 | - JDK 1.8 29 | 30 | ## 运行截图 31 | 32 | ![](screenshot/1.png) 33 | 34 | ![](screenshot/2.png) 35 | 36 | ![](screenshot/3.png) 37 | 38 | ![](screenshot/4.png) 39 | 40 | ![](screenshot/5.png) 41 | 42 | ![](screenshot/6.png) 43 | -------------------------------------------------------------------------------- /web/main/middle.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 4 | 5 | 6 | 7 | 8 | 9 | JSP Page 10 | 11 | 12 | <% 13 | String userName=request.getParameter("userName"); 14 | %> 15 | 16 | 17 | 18 | 19 | 20 | <%-- --%> 21 | 22 | 23 | 24 |
个人信息管理通讯录管理日程安排管理个人文件管理退出主页面欢迎,<%=userName%>登录系统
25 | 26 | 27 | -------------------------------------------------------------------------------- /web/main/main.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : main 3 | Created on : 2012-3-20, 22:12:50 4 | Author : Administrator 5 | --%> 6 | 7 | <%@page import="loginRegister.LoginBean"%> 8 | <%@page import="java.util.ArrayList"%> 9 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 10 | 11 | 12 | 13 | 14 | 个人信息管理系统--主页面 15 | 16 | <% 17 | String userName=null; 18 | //获取在LoginServlet.java中保存在session对象中的数据 19 | ArrayList login=(ArrayList)session.getAttribute("login"); 20 | if(login==null||login.size()==0){ 21 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 22 | }else{ 23 | for(int i=login.size()-1;i>=0;i--){ 24 | LoginBean nn=(LoginBean)login.get(i); 25 | userName=nn.getUserName(); 26 | } 27 | } 28 | %> 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /web/fileManager/fileUp.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : fileUp 3 | Created on : 2012-3-21, 22:22:57 4 | Author : Administrator 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | 个人信息管理系统->文件上传 13 | 14 | 15 |
16 |
17 | 18 | 19 | 22 | 25 | 28 | 31 | 32 |
20 | 上传文件 21 | 23 | 文件列表 24 | 26 | 下载文件 27 | 29 | 删除文件 30 |
33 |
34 |
35 |

36 |
37 | 38 | 39 | 40 | 43 | 44 | 45 | 49 | 50 |
上传文件 41 | 42 |
46 |       47 | 48 |
51 |
52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /web/dateManager/deleteDate.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 2 | 3 | 4 | 5 | 6 | 7 | 个人信息管理系统-删除日程 8 | 9 | 10 |
11 |
12 | 13 | 14 | 17 | 20 | 23 | 26 | 27 |
15 | 增加日程 16 | 18 | 查看日程 19 | 21 | 修改日程 22 | 24 | 删除日程 25 |
28 |
29 |
30 |

31 |
32 | 33 | 34 | 35 | 40 | 41 | 42 | 46 | 47 |
日程时间 36 | 20年 37 | 月 38 | 日 39 |
43 |       44 | 45 |
48 |
49 | 50 | 51 | -------------------------------------------------------------------------------- /web/friendManager/updateFriend.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : updateFriend 3 | Created on : 2012-3-21, 1:09:12 4 | Author : Administrator 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | 个人信息管理系统->修改通讯录 13 | 14 | 15 |
16 |
17 | 18 | 19 | 22 | 25 | 28 | 31 | 32 |
20 | 增加联系人 21 | 23 | 查看通讯录 24 | 26 | 修改联系人 27 | 29 | 删除联系人 30 |
33 |
34 |
35 |

36 |
37 | 38 | 39 | 43 | 44 | 45 | 49 | 50 |
40 |

请输入要修改人的姓名

41 | 姓名
42 |
46 |       47 | 48 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /src/friendManager/LookFriendBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package friendManager; 6 | 7 | /** 8 | * 9 | * @author Administrator 10 | */ 11 | public class LookFriendBean { 12 | private String name; 13 | private String phone; 14 | private String email; 15 | private String workPlace; 16 | private String place; 17 | private String QQ; 18 | 19 | /** 20 | * @return the name 21 | */ 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | /** 27 | * @param name the name to set 28 | */ 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | /** 34 | * @return the phone 35 | */ 36 | public String getPhone() { 37 | return phone; 38 | } 39 | 40 | /** 41 | * @param phone the phone to set 42 | */ 43 | public void setPhone(String phone) { 44 | this.phone = phone; 45 | } 46 | 47 | /** 48 | * @return the email 49 | */ 50 | public String getEmail() { 51 | return email; 52 | } 53 | 54 | /** 55 | * @param email the email to set 56 | */ 57 | public void setEmail(String email) { 58 | this.email = email; 59 | } 60 | 61 | /** 62 | * @return the workPlace 63 | */ 64 | public String getWorkPlace() { 65 | return workPlace; 66 | } 67 | 68 | /** 69 | * @param workPlace the workPlace to set 70 | */ 71 | public void setWorkPlace(String workPlace) { 72 | this.workPlace = workPlace; 73 | } 74 | 75 | /** 76 | * @return the place 77 | */ 78 | public String getPlace() { 79 | return place; 80 | } 81 | 82 | /** 83 | * @param place the place to set 84 | */ 85 | public void setPlace(String place) { 86 | this.place = place; 87 | } 88 | 89 | /** 90 | * @return the QQ 91 | */ 92 | public String getQQ() { 93 | return QQ; 94 | } 95 | 96 | /** 97 | * @param QQ the QQ to set 98 | */ 99 | public void setQQ(String QQ) { 100 | this.QQ = QQ; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /web/friendManager/deleteFriend.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : deleteFriend 3 | Created on : 2012-3-21, 19:22:36 4 | Author : Administrator 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | 个人信息管理系统->删除通讯录 13 | 14 | 15 |
16 |
17 | 18 | 19 | 22 | 25 | 28 | 31 | 32 |
20 | 增加联系人 21 | 23 | 查看通讯录 24 | 26 | 修改联系人 27 | 29 | 删除联系人 30 |
33 |
34 |
35 |

36 |
37 | 38 | 39 | 43 | 44 | 45 | 49 | 50 |
40 |

请输入要删除人的姓名

41 | 姓名
42 |
46 |       47 | 48 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /web/dateManager/addDate.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 4 | 5 | 6 | 7 | 8 | 个人信息管理系统->增加日程 9 | 10 | 11 |
12 |
13 | 14 | 15 | 18 | 21 | 24 | 27 | 28 |
16 | 增加日程 17 | 19 | 查看日程 20 | 22 | 修改日程 23 | 25 | 删除日程 26 |
29 |
30 |
31 |

32 |
33 | 34 | 35 | 36 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 52 |
日程时间 37 | 20年 38 | 月 39 | 日 40 |
日程内容
48 |       49 | 50 |
53 |
54 | 55 | 56 | -------------------------------------------------------------------------------- /web/dateManager/updateDate.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 2 | 3 | 4 | 5 | 6 | 7 | 个人信息管理系统->修改日程 8 | 9 | 10 |
11 |
12 | 13 | 14 | 17 | 20 | 23 | 26 | 27 |
15 | 增加日程 16 | 18 | 查看日程 19 | 21 | 修改日程 22 | 24 | 删除日程 25 |
28 |
29 |
30 |

31 |
32 | 33 | 34 | 35 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 50 | 51 |
日程时间 36 | 20年 37 | 月 38 | 日 39 |
日程内容
47 |       48 | 49 |
52 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /web/dateManager/lookDate.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@page import="dateManager.LookDateBean"%> 3 | <%@page import="java.util.ArrayList"%> 4 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 5 | 6 | 7 | 8 | 9 | 10 | 个人信息管理系统->查看日程 11 | 12 | 13 |
14 |
15 | 16 | 17 | 20 | 23 | 26 | 29 | 30 |
18 | 增加日程 19 | 21 | 查看日程 22 | 24 | 修改日程 25 | 27 | 删除日程 28 |
31 |
32 |
33 |

34 |
35 | 36 | 37 | 38 | 39 | 40 | <% 41 | ArrayList datelist=(ArrayList)session.getAttribute("datelist"); 42 | if(datelist==null||datelist.size()==0){ 43 | %> 44 |
45 |

您还没有任何日程安排!

46 |
47 | <% 48 | }else{ 49 | for(int i=datelist.size()-1;i>=0;i--){ 50 | LookDateBean dd=(LookDateBean)datelist.get(i); 51 | %> 52 | 53 | 54 | 55 | 56 | <% 57 | } 58 | } 59 | %> 60 |
日程时间日程内容
<%=dd.getDate()%><%=dd.getThing()%>
61 |
62 | 63 | 64 | -------------------------------------------------------------------------------- /src/lookMessage/LookMessageServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package lookMessage; 6 | 7 | import java.io.IOException; 8 | import java.sql.*; 9 | import java.util.ArrayList; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | 16 | /** 17 | * 18 | * @author Administrator 19 | */ 20 | public class LookMessageServlet extends HttpServlet { 21 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 22 | throws ServletException, IOException { 23 | String userName=request.getParameter("userName"); 24 | try{ 25 | Connection con=null; 26 | Statement stmt=null; 27 | ResultSet rs=null; 28 | Class.forName("com.mysql.jdbc.Driver"); 29 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 30 | con=DriverManager.getConnection(url,"root","123456"); 31 | stmt=con.createStatement(); 32 | String sql="select * from user where userName='"+userName+"'"; 33 | rs=stmt.executeQuery(sql); 34 | LookMessageBean mm=new LookMessageBean(); 35 | while(rs.next()){ 36 | mm.setName(rs.getString("name")); 37 | mm.setSex(rs.getString("sex")); 38 | mm.setBirth(rs.getString("birth")); 39 | mm.setNation(rs.getString("nation")); 40 | mm.setEdu(rs.getString("edu")); 41 | mm.setWork(rs.getString("work")); 42 | mm.setPhone(rs.getString("phone")); 43 | mm.setPlace(rs.getString("place")); 44 | mm.setEmail(rs.getString("email")); 45 | } 46 | HttpSession session=request.getSession(); 47 | ArrayList wordlist=wordlist=new ArrayList(); 48 | wordlist.add(mm); 49 | session.setAttribute("wordlist", wordlist); 50 | rs.close(); 51 | stmt.close(); 52 | con.close(); 53 | response.sendRedirect("http://localhost:8084/PIMS/lookMessage/lookMessage.jsp"); 54 | }catch(Exception e){ 55 | e.printStackTrace(); 56 | } 57 | 58 | } 59 | 60 | @Override 61 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 62 | throws ServletException, IOException { 63 | doGet(request, response); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /web/friendManager/lookFriend.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="friendManager.LookFriendBean"%> 2 | <%@page import="java.util.ArrayList"%> 3 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 4 | 5 | 6 | 7 | 8 | 个人信息管理系统--查看通讯录 9 | 10 | 11 |
12 |
13 | 14 | 15 | 18 | 21 | 24 | 27 | 28 |
16 | 增加联系人 17 | 19 | 查看通讯录 20 | 22 | 修改联系人 23 | 25 | 删除联系人 26 |
29 |
30 |
31 |

32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | <% 43 | ArrayList friendslist=(ArrayList)session.getAttribute("friendslist"); 44 | if(friendslist==null||friendslist.size()==0){ 45 | %> 46 |
47 |

您还没有任何联系人!

48 |
49 | <% 50 | }else{ 51 | for(int i=friendslist.size()-1;i>=0;i--){ 52 | LookFriendBean ff=(LookFriendBean)friendslist.get(i); 53 | %> 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | <% 63 | } 64 | } 65 | %> 66 |
用户姓名用户电话邮箱地址工作单位家庭住址用户QQ
<%=ff.getName()%><%=ff.getPhone()%><%=ff.getEmail()%><%=ff.getWorkPlace()%><%=ff.getPlace()%><%=ff.getQQ()%>
67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/dateManager/LookDateServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package dateManager; 6 | 7 | import java.io.IOException; 8 | import java.sql.*; 9 | import java.util.ArrayList; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | import loginRegister.LoginBean; 16 | 17 | /** 18 | * 19 | * @author Administrator 20 | */ 21 | public class LookDateServlet extends HttpServlet { 22 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 23 | throws ServletException, IOException { 24 | try{ 25 | Connection con=null; 26 | Statement stmt=null; 27 | ResultSet rs=null; 28 | Class.forName("com.mysql.jdbc.Driver"); 29 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 30 | con=DriverManager.getConnection(url,"root","123456"); 31 | stmt=con.createStatement(); 32 | String userName=""; 33 | HttpSession session=request.getSession(); 34 | ArrayList login=(ArrayList)session.getAttribute("login"); 35 | if(login==null||login.size()==0){ 36 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 37 | }else{ 38 | for(int i=login.size()-1;i>=0;i--){ 39 | LoginBean nn=(LoginBean)login.get(i); 40 | userName=nn.getUserName(); 41 | } 42 | } 43 | String sql="select * from date where userName='"+userName+"'"; 44 | rs=stmt.executeQuery(sql); 45 | ArrayList datelist=null; 46 | datelist=new ArrayList(); 47 | while(rs.next()){ 48 | LookDateBean dd=new LookDateBean(); 49 | dd.setDate(rs.getString("date")); 50 | dd.setThing(rs.getString("thing")); 51 | datelist.add(dd); 52 | session.setAttribute("datelist", datelist); 53 | } 54 | rs.close(); 55 | stmt.close(); 56 | con.close(); 57 | response.sendRedirect("http://localhost:8084/PIMS/dateManager/lookDate.jsp"); 58 | }catch(Exception e){ 59 | e.printStackTrace(); 60 | } 61 | } 62 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 63 | throws ServletException, IOException { 64 | doGet(request, response); 65 | } 66 | 67 | } -------------------------------------------------------------------------------- /web/lookMessage/updatePassword.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : updatePassword 3 | Created on : 2012-3-20, 23:58:33 4 | Author : Administrator 5 | --%> 6 | 7 | <%@page import="loginRegister.LoginBean"%> 8 | <%@page import="java.util.ArrayList"%> 9 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 10 | 11 | 12 | 13 | 14 | JSP Page 15 | 16 | 17 |
18 |
19 | 20 | 21 | 24 | 27 | 30 | 31 |
22 | 查看个人信息 23 | 25 | 修改个人信息 26 | 28 | 修改密码 29 |
32 |
33 |
34 |

35 |
36 | 37 | <% 38 | ArrayList login=(ArrayList)session.getAttribute("login"); 39 | if(login==null||login.size()==0){ 40 | response.sendRedirect("http://localhost:8084/PIMS/main/bottom.jsp"); 41 | }else{ 42 | for(int i=login.size()-1;i>=0;i--){ 43 | LoginBean nn=(LoginBean)login.get(i); 44 | %> 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 58 | 59 | <% 60 | } 61 | } 62 | %> 63 |
用户密码
重复密码
55 |       56 | 57 |
64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /web/login.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 个人信息管理系统--登录页面 8 | 14 | 15 | 16 | 17 | 18 | 21 | 24 | 25 | 26 | 29 | 30 | 31 | 34 | 58 | 59 |
19 | 校训 20 | 22 |

个人信息管理系统

23 |
27 |
28 |
32 | 风景 33 | 35 |
36 | 37 | 38 | 43 | 44 | 45 | 49 | 50 | 51 | 54 | 55 |
39 | 输入用户姓名:
40 |

41 | 输入用户密码:
42 |
46 |       47 | 48 |
52 |

注册

53 |
56 |
57 |
60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /src/fileManager/FileUpServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package fileManager; 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import javax.servlet.ServletException; 10 | import javax.servlet.http.HttpServlet; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | 14 | /** 15 | * 16 | * @author Administrator 17 | */ 18 | public class FileUpServlet extends HttpServlet { 19 | 20 | /** 21 | * Processes requests for both HTTP GET and POST methods. 22 | * @param request servlet request 23 | * @param response servlet response 24 | * @throws ServletException if a servlet-specific error occurs 25 | * @throws IOException if an I/O error occurs 26 | */ 27 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 28 | throws ServletException, IOException { 29 | response.setContentType("text/html;charset=UTF-8"); 30 | PrintWriter out = response.getWriter(); 31 | try { 32 | 33 | out.println(""); 34 | out.println(""); 35 | out.println("Servlet FileUpServlet"); 36 | out.println(""); 37 | out.println(""); 38 | out.println("

" + "请编码实现本功能!"+ "

"); 39 | out.println(""); 40 | out.println(""); 41 | 42 | } finally { 43 | out.close(); 44 | } 45 | } 46 | 47 | // 48 | /** 49 | * Handles the HTTP GET method. 50 | * @param request servlet request 51 | * @param response servlet response 52 | * @throws ServletException if a servlet-specific error occurs 53 | * @throws IOException if an I/O error occurs 54 | */ 55 | @Override 56 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 57 | throws ServletException, IOException { 58 | processRequest(request, response); 59 | } 60 | 61 | /** 62 | * Handles the HTTP POST method. 63 | * @param request servlet request 64 | * @param response servlet response 65 | * @throws ServletException if a servlet-specific error occurs 66 | * @throws IOException if an I/O error occurs 67 | */ 68 | @Override 69 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 70 | throws ServletException, IOException { 71 | processRequest(request, response); 72 | } 73 | 74 | /** 75 | * Returns a short description of the servlet. 76 | * @return a String containing servlet description 77 | */ 78 | @Override 79 | public String getServletInfo() { 80 | return "Short description"; 81 | }// 82 | } 83 | -------------------------------------------------------------------------------- /src/lookMessage/LookMessageBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package lookMessage; 6 | 7 | /** 8 | * 9 | * @author Administrator 10 | */ 11 | public class LookMessageBean { 12 | private String name; 13 | private String sex; 14 | private String birth; 15 | private String nation; 16 | private String edu; 17 | private String work; 18 | private String phone; 19 | private String place; 20 | private String email; 21 | public LookMessageBean(){ 22 | } 23 | 24 | /** 25 | * @return the name 26 | */ 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | /** 32 | * @param name the name to set 33 | */ 34 | public void setName(String name) { 35 | this.name = name; 36 | } 37 | 38 | /** 39 | * @return the sex 40 | */ 41 | public String getSex() { 42 | return sex; 43 | } 44 | 45 | /** 46 | * @param sex the sex to set 47 | */ 48 | public void setSex(String sex) { 49 | this.sex = sex; 50 | } 51 | 52 | /** 53 | * @return the birth 54 | */ 55 | public String getBirth() { 56 | return birth; 57 | } 58 | 59 | /** 60 | * @param birth the birth to set 61 | */ 62 | public void setBirth(String birth) { 63 | this.birth = birth; 64 | } 65 | 66 | /** 67 | * @return the nation 68 | */ 69 | public String getNation() { 70 | return nation; 71 | } 72 | 73 | /** 74 | * @param nation the nation to set 75 | */ 76 | public void setNation(String nation) { 77 | this.nation = nation; 78 | } 79 | 80 | /** 81 | * @return the edu 82 | */ 83 | public String getEdu() { 84 | return edu; 85 | } 86 | 87 | /** 88 | * @param edu the edu to set 89 | */ 90 | public void setEdu(String edu) { 91 | this.edu = edu; 92 | } 93 | 94 | /** 95 | * @return the work 96 | */ 97 | public String getWork() { 98 | return work; 99 | } 100 | 101 | /** 102 | * @param work the work to set 103 | */ 104 | public void setWork(String work) { 105 | this.work = work; 106 | } 107 | 108 | /** 109 | * @return the phone 110 | */ 111 | public String getPhone() { 112 | return phone; 113 | } 114 | 115 | /** 116 | * @param phone the phone to set 117 | */ 118 | public void setPhone(String phone) { 119 | this.phone = phone; 120 | } 121 | 122 | /** 123 | * @return the place 124 | */ 125 | public String getPlace() { 126 | return place; 127 | } 128 | 129 | /** 130 | * @param place the place to set 131 | */ 132 | public void setPlace(String place) { 133 | this.place = place; 134 | } 135 | 136 | /** 137 | * @return the email 138 | */ 139 | public String getEmail() { 140 | return email; 141 | } 142 | 143 | /** 144 | * @param email the email to set 145 | */ 146 | public void setEmail(String email) { 147 | this.email = email; 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /web/lookMessage/lookMessage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : lookMessage 3 | Created on : 2012-3-20, 23:13:38 4 | Author : Administrator 5 | --%> 6 | 7 | <%@page import="lookMessage.LookMessageBean"%> 8 | <%@page import="java.util.ArrayList"%> 9 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 10 | 11 | 12 | 13 | 14 | 个人信息管理系统--查看个人信息 15 | 16 | 17 |
18 |
19 | 20 | 21 | 24 | 27 | 30 | 31 |
22 | 修改个人信息 23 | 25 | 查看个人信息 26 | 28 | 修改密码 29 |
32 |
33 |
34 |

35 | 36 | <% 37 | ArrayList wordlist=(ArrayList)session.getAttribute("wordlist"); 38 | if(wordlist==null||wordlist.size()==0){ 39 | response.sendRedirect("http://localhost:8084/PIMS/main/bottom.jsp"); 40 | }else{ 41 | for(int i=wordlist.size()-1;i>=0;i--){ 42 | LookMessageBean mm=(LookMessageBean)wordlist.get(i); 43 | %> 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | <% 81 | } 82 | } 83 | %> 84 |
用户姓名<%=mm.getName()%>
用户性别<%=mm.getSex()%>
出生日期<%=mm.getBirth()%>
用户民族<%=mm.getNation()%>
用户学历<%=mm.getEdu()%>
用户类型<%=mm.getWork()%>
用户电话<%=mm.getPhone()%>
家庭住址<%=mm.getPlace()%>
邮箱地址<%=mm.getEmail()%>
85 | 86 | 87 | -------------------------------------------------------------------------------- /src/friendManager/LookFriendServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package friendManager; 6 | 7 | import java.io.IOException; 8 | import java.sql.*; 9 | import java.util.ArrayList; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | import javax.swing.JOptionPane; 16 | import loginRegister.LoginBean; 17 | 18 | /** 19 | * 20 | * @author Administrator 21 | */ 22 | public class LookFriendServlet extends HttpServlet { 23 | public void wrong1(){ 24 | String msg="不允许有空,注册失败!"; 25 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 26 | String title="信息提示"; 27 | JOptionPane.showMessageDialog(null, msg, title, type); 28 | } 29 | @Override 30 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 31 | throws ServletException, IOException { 32 | try{ 33 | Connection con=null; 34 | Statement stmt=null; 35 | ResultSet rs=null; 36 | Class.forName("com.mysql.jdbc.Driver"); 37 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 38 | con=DriverManager.getConnection(url,"root","123456"); 39 | stmt=con.createStatement(); 40 | String userName=""; 41 | HttpSession session=request.getSession(); 42 | ArrayList login=(ArrayList)session.getAttribute("login"); 43 | if(login==null||login.size()==0){ 44 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 45 | }else{ 46 | for(int i=login.size()-1;i>=0;i--){ 47 | LoginBean nn=(LoginBean)login.get(i); 48 | userName=nn.getUserName(); 49 | } 50 | } 51 | String sql1="select * from friends where userName='"+userName+"'"; 52 | rs=stmt.executeQuery(sql1); 53 | ArrayList friendslist=null; 54 | if((ArrayList)session.getAttribute("friendslist")==null){ 55 | friendslist=new ArrayList(); 56 | while(rs.next()){ 57 | LookFriendBean ff=new LookFriendBean(); 58 | ff.setName(rs.getString("name")); 59 | ff.setPhone(rs.getString("phone")); 60 | ff.setEmail(rs.getString("email")); 61 | ff.setWorkPlace(rs.getString("workPlace")); 62 | ff.setPlace(rs.getString("place")); 63 | ff.setQQ(rs.getString("QQ")); 64 | friendslist.add(ff); 65 | session.setAttribute("friendslist", friendslist); 66 | } 67 | } 68 | rs.close(); 69 | stmt.close(); 70 | con.close(); 71 | response.sendRedirect("http://localhost:8084/PIMS/friendManager/lookFriend.jsp"); 72 | }catch(Exception e){ 73 | e.printStackTrace(); 74 | } 75 | } 76 | 77 | @Override 78 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 79 | throws ServletException, IOException { 80 | doGet(request, response); 81 | } 82 | 83 | } -------------------------------------------------------------------------------- /web/friendManager/updateFriendMessage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : updateFriendMessage 3 | Created on : 2012-3-21, 1:33:34 4 | Author : Administrator 5 | --%> 6 | 7 | <%@page import="friendManager.LookFriendBean"%> 8 | <%@page import="java.util.ArrayList"%> 9 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 10 | 11 | 12 | 13 | 14 | 个人信息管理系统->修改通讯录 15 | 16 | 17 |
18 |
19 | 20 | 21 | 24 | 27 | 30 | 33 | 34 |
22 | 增加联系人 23 | 25 | 查看通讯录 26 | 28 | 修改联系人 29 | 31 | 删除联系人 32 |
35 |
36 |
37 |

38 |
39 | 40 | <% 41 | ArrayList friendslist2=(ArrayList)session.getAttribute("friendslist2"); 42 | if(friendslist2==null||friendslist2.size()==0){ 43 | response.sendRedirect("http://localhost:8084/PIMS/friendManager/lookFriend.jsp"); 44 | }else{ 45 | for(int i=friendslist2.size()-1;i>=0;i--){ 46 | LookFriendBean ff=(LookFriendBean)friendslist2.get(i); 47 | %> 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 77 | 78 | <% 79 | } 80 | } 81 | %> 82 |
用户姓名<%=ff.getName()%>
用户电话
邮箱地址
工作单位
家庭住址
用户QQ
74 |       75 | 76 |
83 |
84 | 85 | 86 | -------------------------------------------------------------------------------- /src/friendManager/UpdateFriendServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package friendManager; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import javax.servlet.http.HttpSession; 12 | import javax.swing.*; 13 | import java.io.IOException; 14 | import java.sql.Connection; 15 | import java.sql.DriverManager; 16 | import java.sql.ResultSet; 17 | import java.sql.Statement; 18 | import java.util.ArrayList; 19 | 20 | /** 21 | * 22 | * @author Administrator 23 | */ 24 | public class UpdateFriendServlet extends HttpServlet { 25 | public void wrong1(){ 26 | String msg="请输入要修改人的姓名!"; 27 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 28 | String title="信息提示"; 29 | JOptionPane.showMessageDialog(null, msg, title, type); 30 | } 31 | public void wrong2(){ 32 | String msg="此姓名不存在,无法修改!"; 33 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 34 | String title="信息提示"; 35 | JOptionPane.showMessageDialog(null, msg, title, type); 36 | } 37 | @Override 38 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | String friendName=new String(request.getParameter("friendName").getBytes("ISO-8859-1"),"UTF-8"); 41 | if(friendName.length()==0){ 42 | wrong1(); 43 | response.sendRedirect("http://localhost:8084/PIMS/friendManager/updateFriend.jsp"); 44 | }else{ 45 | try{ 46 | Connection con=null; 47 | Statement stmt=null; 48 | ResultSet rs=null; 49 | Class.forName("com.mysql.jdbc.Driver"); 50 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 51 | con=DriverManager.getConnection(url,"root","123456"); 52 | stmt=con.createStatement(); 53 | String sql1="select * from friends where name='"+friendName+"'"; 54 | rs=stmt.executeQuery(sql1); 55 | rs.last(); 56 | int k=rs.getRow(); 57 | rs.beforeFirst(); 58 | if(k<1){ 59 | wrong2(); 60 | response.sendRedirect("http://localhost:8084/PIMS/friendManager/updateFriend.jsp"); 61 | }else{ 62 | HttpSession session=request.getSession(); 63 | ArrayList friendslist2=null; 64 | friendslist2=new ArrayList(); 65 | while(rs.next()){ 66 | LookFriendBean ff=new LookFriendBean(); 67 | ff.setName(rs.getString("name")); 68 | ff.setPhone(rs.getString("phone")); 69 | ff.setEmail(rs.getString("email")); 70 | ff.setWorkPlace(rs.getString("workPlace")); 71 | ff.setPlace(rs.getString("place")); 72 | ff.setQQ(rs.getString("QQ")); 73 | friendslist2.add(ff); 74 | session.setAttribute("friendslist2", friendslist2); 75 | } 76 | ArrayList friendslist3=null; 77 | UpdateFriendBean nn=new UpdateFriendBean(); 78 | friendslist3=new ArrayList(); 79 | nn.setName(friendName); 80 | friendslist3.add(nn); 81 | session.setAttribute("friendslist3", friendslist3); 82 | } 83 | rs.close(); 84 | stmt.close(); 85 | con.close(); 86 | response.sendRedirect("http://localhost:8084/PIMS/friendManager/updateFriendMessage.jsp"); 87 | }catch(Exception e){ 88 | e.printStackTrace(); 89 | } 90 | } 91 | } 92 | 93 | @Override 94 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 95 | throws ServletException, IOException { 96 | doGet(request, response); 97 | } 98 | 99 | } -------------------------------------------------------------------------------- /src/lookMessage/UpdatePasswordServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package lookMessage; 6 | 7 | import java.io.IOException; 8 | import java.sql.*; 9 | import java.util.ArrayList; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | import javax.swing.JOptionPane; 16 | import loginRegister.LoginBean; 17 | 18 | /** 19 | * 20 | * @author Administrator 21 | */ 22 | public class UpdatePasswordServlet extends HttpServlet { 23 | public void wrong1(){ 24 | String msg="不允许有空,修改失败!"; 25 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 26 | String title="信息提示"; 27 | JOptionPane.showMessageDialog(null, msg, title, type); 28 | } 29 | public void wrong2(){ 30 | String msg="两次密码不同,修改失败!"; 31 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 32 | String title="信息提示"; 33 | JOptionPane.showMessageDialog(null, msg, title, type); 34 | } 35 | public void right(){ 36 | String msg="填写信息合格,修改成功!"; 37 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 38 | String title="信息提示"; 39 | JOptionPane.showMessageDialog(null, msg, title, type); 40 | } 41 | @Override 42 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 43 | throws ServletException, IOException { 44 | String password1=new String(request.getParameter("password1").getBytes("ISO-8859-1"),"UTF-8"); 45 | String password2=new String(request.getParameter("password2").getBytes("ISO-8859-1"),"UTF-8"); 46 | if(password1.length()==0||password2.length()==0){ 47 | wrong1(); 48 | response.sendRedirect("http://localhost:8084/PIMS/lookMessage/updatePassword.jsp"); 49 | }else if(!(password1.equals(password2))){ 50 | wrong2(); 51 | response.sendRedirect("http://localhost:8084/PIMS/lookMessage/updatePassword.jsp"); 52 | }else{ 53 | try{ 54 | Connection con=null; 55 | Statement stmt=null; 56 | ResultSet rs=null; 57 | Class.forName("com.mysql.jdbc.Driver"); 58 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 59 | con=DriverManager.getConnection(url,"root","123456"); 60 | stmt=con.createStatement(); 61 | String userName=""; 62 | HttpSession session=request.getSession(); 63 | ArrayList login=(ArrayList)session.getAttribute("login"); 64 | if(login==null||login.size()==0){ 65 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 66 | }else{ 67 | for(int i=login.size()-1;i>=0;i--){ 68 | LoginBean nn=(LoginBean)login.get(i); 69 | userName=nn.getUserName(); 70 | } 71 | } 72 | String sql1="Update user set password='"+password1+"' where userName='"+userName+"'"; 73 | stmt.executeUpdate(sql1); 74 | String sql2="select * from user where userName='"+userName+"'"; 75 | rs=stmt.executeQuery(sql2); 76 | LoginBean nn=new LoginBean(); 77 | nn.setPassword(password1); 78 | ArrayList wordlist=null; 79 | wordlist=new ArrayList(); 80 | wordlist.add(nn); 81 | session.setAttribute("login", login); 82 | rs.close(); 83 | stmt.close(); 84 | con.close(); 85 | right(); 86 | response.sendRedirect("http://localhost:8084/PIMS/lookMessage/lookMessage.jsp"); 87 | }catch(Exception e){ 88 | e.printStackTrace(); 89 | } 90 | } 91 | } 92 | 93 | @Override 94 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 95 | throws ServletException, IOException { 96 | doGet(request, response); 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/lookMessage/UpdateMessageServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package lookMessage; 6 | 7 | import java.io.IOException; 8 | import java.sql.*; 9 | import java.util.ArrayList; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | import javax.swing.JOptionPane; 16 | import loginRegister.LoginBean; 17 | 18 | /** 19 | * 20 | * @author Administrator 21 | */ 22 | public class UpdateMessageServlet extends HttpServlet { 23 | public void wrong1(){ 24 | String msg="不允许有空,修改失败!"; 25 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 26 | String title="信息提示"; 27 | JOptionPane.showMessageDialog(null, msg, title, type); 28 | } 29 | public void right(){ 30 | String msg="填写信息合格,修改成功!"; 31 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 32 | String title="信息提示"; 33 | JOptionPane.showMessageDialog(null, msg, title, type); 34 | } 35 | 36 | @Override 37 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | String edu=new String(request.getParameter("edu").getBytes("ISO-8859-1"),"UTF-8"); 40 | String work=new String(request.getParameter("work").getBytes("ISO-8859-1"),"UTF-8"); 41 | String phone=new String(request.getParameter("phone").getBytes("ISO-8859-1"),"UTF-8"); 42 | String email=new String(request.getParameter("email").getBytes("ISO-8859-1"),"UTF-8"); 43 | if(phone.length()==0||email.length()==0){ 44 | wrong1(); 45 | response.sendRedirect("http://localhost:8084/PIMS/lookMessage/updateMessage.jsp"); 46 | }else{ 47 | try{ 48 | Connection con=null; 49 | Statement stmt=null; 50 | ResultSet rs=null; 51 | Class.forName("com.mysql.jdbc.Driver"); 52 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 53 | con=DriverManager.getConnection(url,"root","123456"); 54 | stmt=con.createStatement(); 55 | String userName=""; 56 | HttpSession session=request.getSession(); 57 | ArrayList login=(ArrayList)session.getAttribute("login"); 58 | if(login==null||login.size()==0){ 59 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 60 | }else{ 61 | for(int i=login.size()-1;i>=0;i--){ 62 | LoginBean nn=(LoginBean)login.get(i); 63 | userName=nn.getUserName(); 64 | } 65 | } 66 | String sql1="Update user set edu='"+edu+"',work='"+work+"',phone='"+phone+"',email='"+email+"' where userName='"+userName+"'"; 67 | stmt.executeUpdate(sql1); 68 | String sql2="select * from user where userName='"+userName+"'"; 69 | rs=stmt.executeQuery(sql2); 70 | LookMessageBean mm=new LookMessageBean(); 71 | while(rs.next()){ 72 | mm.setName(rs.getString("name")); 73 | mm.setSex(rs.getString("sex")); 74 | mm.setBirth(rs.getString("birth")); 75 | mm.setNation(rs.getString("nation")); 76 | mm.setEdu(rs.getString("edu")); 77 | mm.setWork(rs.getString("work")); 78 | mm.setPhone(rs.getString("phone")); 79 | mm.setPlace(rs.getString("place")); 80 | mm.setEmail(rs.getString("email")); 81 | } 82 | ArrayList wordlist=null; 83 | wordlist=new ArrayList(); 84 | wordlist.add(mm); 85 | session.setAttribute("wordlist", wordlist); 86 | rs.close(); 87 | stmt.close(); 88 | con.close(); 89 | right(); 90 | response.sendRedirect("http://localhost:8084/PIMS/lookMessage/lookMessage.jsp"); 91 | }catch(Exception e){ 92 | e.printStackTrace(); 93 | } 94 | } 95 | } 96 | 97 | @Override 98 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 99 | throws ServletException, IOException { 100 | doGet(request, response); 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /src/loginRegister/LoginServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package loginRegister; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import javax.servlet.http.HttpSession; 12 | import javax.swing.*; 13 | import java.io.IOException; 14 | import java.sql.Connection; 15 | import java.sql.DriverManager; 16 | import java.sql.ResultSet; 17 | import java.sql.Statement; 18 | import java.util.ArrayList; 19 | 20 | /** 21 | * 22 | * @author Administrator 23 | */ 24 | public class LoginServlet extends HttpServlet { 25 | public void wrong1(){//对话框提示信息 26 | String msg="用户名不能为空!"; 27 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 28 | String title="信息提示"; 29 | JOptionPane.showMessageDialog(null, msg, title, type); 30 | } 31 | public void wrong2(){ 32 | String msg="用户密码不能为空,登录失败!"; 33 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 34 | String title="信息提示"; 35 | JOptionPane.showMessageDialog(null, msg, title, type); 36 | } 37 | public void wrong3(){ 38 | String msg="该用户尚未注册,登录失败!"; 39 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 40 | String title="信息提示"; 41 | JOptionPane.showMessageDialog(null, msg, title, type); 42 | } 43 | public void wrong4(){ 44 | String msg="用户密码不正确,登录失败!"; 45 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 46 | String title="信息提示"; 47 | JOptionPane.showMessageDialog(null, msg, title, type); 48 | } 49 | 50 | @Override 51 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 52 | throws ServletException, IOException { 53 | String userName=new String(request.getParameter("userName").getBytes("ISO-8859-1"),"UTF-8"); 54 | String password=new String(request.getParameter("password").getBytes("ISO-8859-1"),"UTF-8"); 55 | if(userName.equals("")){ 56 | wrong1(); 57 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 58 | }else if(password.equals("")){ 59 | wrong2(); 60 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 61 | }else{ 62 | try{ 63 | Connection con=null; 64 | Statement stmt=null; 65 | ResultSet rs=null; 66 | Class.forName("com.mysql.jdbc.Driver"); 67 | /*url后面加的?useUnicode=true&characterEncoding=gbk,是为了处理向数据库中添加数据时出现乱码的问题。*/ 68 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 69 | con=DriverManager.getConnection(url,"root","123456"); 70 | stmt=con.createStatement(); 71 | String sql="select * from user where userName='"+userName+"'"; 72 | rs=stmt.executeQuery(sql); 73 | int N=0; 74 | int P=0; 75 | while(rs.next()){ 76 | if(userName.equals(rs.getString("userName"))){ 77 | N=111111; 78 | if(password.equals(rs.getString("password"))){ 79 | P=111111; 80 | LoginBean nn=new LoginBean();//实例化保存个人信息的JavaBean 81 | nn.setUserName(userName);//保存用户名 82 | nn.setPassword(password);//保存密码 83 | HttpSession session=request.getSession();//获取session对象 84 | ArrayList login=new ArrayList();//实例化列表对象 85 | login.add(nn);//把个人信息保存到列表中 86 | session.setAttribute("login", login);//把列表保存到session对象中,以便在别的页面中获取个人信息 87 | response.sendRedirect("http://localhost:8084/PIMS/main/main.jsp"); 88 | }else{ 89 | 90 | } 91 | }else{ 92 | N++; 93 | } 94 | } 95 | if(N<111111){ 96 | wrong3(); 97 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 98 | }else if(P<111111){ 99 | wrong4(); 100 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 101 | } 102 | }catch(Exception e){ 103 | e.printStackTrace(); 104 | } 105 | } 106 | } 107 | 108 | @Override 109 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 110 | throws ServletException, IOException { 111 | doGet(request, response); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/loginRegister/RegisterServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package loginRegister; 6 | 7 | import java.io.IOException; 8 | import java.sql.*; 9 | import javax.servlet.ServletException; 10 | import javax.servlet.http.HttpServlet; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | import javax.swing.JOptionPane; 14 | 15 | /** 16 | * 17 | * @author Administrator 18 | */ 19 | public class RegisterServlet extends HttpServlet { 20 | public void wrong1(){ 21 | String msg="不允许有空,注册失败!"; 22 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 23 | String title="信息提示"; 24 | JOptionPane.showMessageDialog(null, msg, title, type); 25 | } 26 | public void wrong2(){ 27 | String msg="两次密码不同,注册失败!"; 28 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 29 | String title="信息提示"; 30 | JOptionPane.showMessageDialog(null, msg, title, type); 31 | } 32 | public void wrong3(){ 33 | String msg="用户名已存在,注册失败!"; 34 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 35 | String title="信息提示"; 36 | JOptionPane.showMessageDialog(null, msg, title, type); 37 | } 38 | public void right(){ 39 | String msg="注册信息合格,注册成功!"; 40 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 41 | String title="信息提示"; 42 | JOptionPane.showMessageDialog(null, msg, title, type); 43 | } 44 | 45 | @Override 46 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 47 | throws ServletException, IOException { 48 | String userName=new String(request.getParameter("userName").getBytes("ISO-8859-1"),"UTF-8"); 49 | String password1=new String(request.getParameter("password1").getBytes("ISO-8859-1"),"UTF-8"); 50 | String password2=new String(request.getParameter("password2").getBytes("ISO-8859-1"),"UTF-8"); 51 | String name=new String(request.getParameter("name").getBytes("ISO-8859-1"),"UTF-8"); 52 | String sex=new String(request.getParameter("sex").getBytes("ISO-8859-1"),"UTF-8"); 53 | String birth=request.getParameter("year")+"-"+request.getParameter("mouth")+"-"+request.getParameter("day"); 54 | String nation=new String(request.getParameter("nation").getBytes("ISO-8859-1"),"UTF-8"); 55 | String edu=new String(request.getParameter("edu").getBytes("ISO-8859-1"),"UTF-8"); 56 | String work=new String(request.getParameter("work").getBytes("ISO-8859-1"),"UTF-8"); 57 | String phone=new String(request.getParameter("phone").getBytes("ISO-8859-1"),"UTF-8"); 58 | String place=new String(request.getParameter("place").getBytes("ISO-8859-1"),"UTF-8"); 59 | String email=new String(request.getParameter("email").getBytes("ISO-8859-1"),"UTF-8"); 60 | if(userName.length()==0||password1.length()==0||password2.length()==0||name.length()==0||phone.length()==0||email.length()==0){ 61 | wrong1(); 62 | response.sendRedirect("http://localhost:8084/PIMS/register/register.jsp"); 63 | }else if(!(password1.equals(password2))){ 64 | wrong2(); 65 | response.sendRedirect("http://localhost:8084/PIMS/register/register.jsp"); 66 | }else{ 67 | try{ 68 | Connection con=null; 69 | Statement stmt=null; 70 | ResultSet rs=null; 71 | Class.forName("com.mysql.jdbc.Driver"); 72 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 73 | con=DriverManager.getConnection(url,"root","123456"); 74 | stmt=con.createStatement(); 75 | String sql1="select * from user where userName='"+userName+"'"; 76 | rs=stmt.executeQuery(sql1); 77 | rs.last(); 78 | int k; 79 | k=rs.getRow(); 80 | if(k>0){ 81 | wrong3(); 82 | response.sendRedirect("http://localhost:8084/PIMS/register/register.jsp"); 83 | }else{ 84 | String sql2="insert into user"+"(userName,password,name,sex,birth,nation,edu,work,phone,place,email)"+"values("+"'"+userName+"'"+","+"'"+password1+"'"+","+"'"+name+"'"+","+"'"+sex+"'"+","+"'"+birth+"'"+","+"'"+nation+"'"+","+"'"+edu+"'"+","+"'"+work+"'"+","+"'"+phone+"'"+","+"'"+place+"'"+","+"'"+email+"'"+")"; 85 | stmt.executeUpdate(sql2); 86 | } 87 | rs.close(); 88 | stmt.close(); 89 | con.close(); 90 | right(); 91 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 92 | }catch(Exception e){ 93 | e.printStackTrace(); 94 | } 95 | } 96 | } 97 | 98 | @Override 99 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 100 | throws ServletException, IOException { 101 | doGet(request, response); 102 | } 103 | 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/friendManager/DeleteFriendServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package friendManager; 6 | 7 | import java.io.IOException; 8 | import java.sql.*; 9 | import java.util.ArrayList; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | import javax.swing.JOptionPane; 16 | import loginRegister.LoginBean; 17 | 18 | /** 19 | * 20 | * @author Administrator 21 | */ 22 | public class DeleteFriendServlet extends HttpServlet { 23 | public void wrong1(){ 24 | String msg="请输入要删除的人的姓名!"; 25 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 26 | String title="信息提示"; 27 | JOptionPane.showMessageDialog(null, msg, title, type); 28 | } 29 | public void wrong2(){ 30 | String msg="此联系人不存在!"; 31 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 32 | String title="信息提示"; 33 | JOptionPane.showMessageDialog(null, msg, title, type); 34 | } 35 | public void right(){ 36 | String msg="此联系人已成功删除!"; 37 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 38 | String title="信息提示"; 39 | JOptionPane.showMessageDialog(null, msg, title, type); 40 | } 41 | @Override 42 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 43 | throws ServletException, IOException { 44 | String name=new String(request.getParameter("name").getBytes("ISO-8859-1"),"UTF-8"); 45 | if(name.length()==0){ 46 | wrong1(); 47 | response.sendRedirect("http://localhost:8084/PIMS/friendManager/deleteFriend.jsp"); 48 | }else{ 49 | try{ 50 | Connection con=null; 51 | Statement stmt=null; 52 | ResultSet rs=null; 53 | Class.forName("com.mysql.jdbc.Driver"); 54 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 55 | con=DriverManager.getConnection(url,"root","123456"); 56 | stmt=con.createStatement(); 57 | String userName=""; 58 | HttpSession session=request.getSession(); 59 | ArrayList login=(ArrayList)session.getAttribute("login"); 60 | if(login==null||login.size()==0){ 61 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 62 | }else{ 63 | for(int i=login.size()-1;i>=0;i--){ 64 | LoginBean nn=(LoginBean)login.get(i); 65 | userName=nn.getUserName(); 66 | } 67 | } 68 | String sql1="select * from friends where name='"+name+"'and userName='"+userName+"'"; 69 | rs=stmt.executeQuery(sql1); 70 | rs.last(); 71 | int k=rs.getRow(); 72 | if(k<1){ 73 | wrong2(); 74 | response.sendRedirect("http://localhost:8084/PIMS/friendManager/deleteFriend.jsp"); 75 | }else{ 76 | String sql2="delete from friends where name='"+name+"'and userName='"+userName+"'"; 77 | stmt.executeUpdate(sql2); 78 | String sql3="select * from friends where userName='"+userName+"'"; 79 | rs=stmt.executeQuery(sql3); 80 | rs.last(); 81 | int list=rs.getRow(); 82 | rs.beforeFirst(); 83 | if(list<1){ 84 | ArrayList friendslist=null; 85 | session.setAttribute("friendslist", friendslist); 86 | }else{ 87 | ArrayList friendslist=null; 88 | friendslist=new ArrayList(); 89 | while(rs.next()){ 90 | LookFriendBean ff=new LookFriendBean(); 91 | ff.setName(rs.getString("name")); 92 | ff.setPhone(rs.getString("phone")); 93 | ff.setEmail(rs.getString("email")); 94 | ff.setWorkPlace(rs.getString("workPlace")); 95 | ff.setPlace(rs.getString("place")); 96 | ff.setQQ(rs.getString("QQ")); 97 | friendslist.add(ff); 98 | session.setAttribute("friendslist", friendslist); 99 | } 100 | } 101 | } 102 | rs.close(); 103 | stmt.close(); 104 | con.close(); 105 | response.sendRedirect("http://localhost:8084/PIMS/friendManager/lookFriend.jsp"); 106 | }catch(Exception e){ 107 | e.printStackTrace(); 108 | } 109 | } 110 | } 111 | 112 | @Override 113 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 114 | throws ServletException, IOException { 115 | doGet(request, response); 116 | } 117 | 118 | } -------------------------------------------------------------------------------- /web/friendManager/addFriend.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : addFriend 3 | Created on : 2012-3-21, 0:27:47 4 | Author : Administrator 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | 个人信息管理系统->增加通讯录 13 | 14 | 15 |
16 |
17 | 18 | 19 | 20 | 23 | 26 | 29 | 30 |
增加联系人 21 | 查看通讯录 22 | 24 | 修改联系人 25 | 27 | 删除联系人 28 |
31 |
32 |
33 |

34 |
35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 104 | 105 |
用户姓名
用户电话
邮箱地址
工作单位
家庭住址 55 | 省(直辖市) 93 |
用户QQ
101 |       102 | 103 |
106 |
107 | 108 | 109 | -------------------------------------------------------------------------------- /src/friendManager/UpdateFriendMessageServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package friendManager; 6 | 7 | import java.io.IOException; 8 | import java.sql.*; 9 | import java.util.ArrayList; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | import javax.swing.JOptionPane; 16 | import loginRegister.LoginBean; 17 | 18 | /** 19 | * 20 | * @author Administrator 21 | */ 22 | public class UpdateFriendMessageServlet extends HttpServlet { 23 | public void wrong1(){ 24 | String msg="不允许有空,修改失败!"; 25 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 26 | String title="信息提示"; 27 | JOptionPane.showMessageDialog(null, msg, title, type); 28 | } 29 | public void right(){ 30 | String msg="填写信息合格,修改成功!"; 31 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 32 | String title="信息提示"; 33 | JOptionPane.showMessageDialog(null, msg, title, type); 34 | } 35 | 36 | @Override 37 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | String phone=new String(request.getParameter("phone").getBytes("ISO-8859-1"),"UTF-8"); 40 | String email=new String(request.getParameter("email").getBytes("ISO-8859-1"),"UTF-8"); 41 | String workPlace=new String(request.getParameter("workPlace").getBytes("ISO-8859-1"),"UTF-8"); 42 | String place=new String(request.getParameter("place").getBytes("ISO-8859-1"),"UTF-8"); 43 | String QQ=new String(request.getParameter("QQ").getBytes("ISO-8859-1"),"UTF-8"); 44 | if(phone.length()==0||email.length()==0||workPlace.length()==0||place.length()==0||QQ.length()==0){ 45 | wrong1(); 46 | response.sendRedirect("http://localhost:8084/PIMS/friendManager/updateFriendMessage.jsp"); 47 | }else{ 48 | try{ 49 | 50 | Connection con=null; 51 | Statement stmt=null; 52 | ResultSet rs=null; 53 | Class.forName("com.mysql.jdbc.Driver"); 54 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 55 | con=DriverManager.getConnection(url,"root","123456"); 56 | stmt=con.createStatement(); 57 | String userName=""; 58 | HttpSession session=request.getSession(); 59 | ArrayList login=(ArrayList)session.getAttribute("login"); 60 | if(login==null||login.size()==0){ 61 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 62 | }else{ 63 | for(int i=login.size()-1;i>=0;i--){ 64 | LoginBean nn=(LoginBean)login.get(i); 65 | userName=nn.getUserName(); 66 | } 67 | } 68 | String name=null; 69 | ArrayList friendslist3=(ArrayList)session.getAttribute("friendslist3"); 70 | if(friendslist3==null||friendslist3.size()==0){ 71 | response.sendRedirect("http://localhost:8084/PIMS/main/bottom.jsp"); 72 | }else{ 73 | for(int i=friendslist3.size()-1;i>=0;i--){ 74 | UpdateFriendBean ff=(UpdateFriendBean)friendslist3.get(i); 75 | name=ff.getName(); 76 | } 77 | } 78 | String sql1="update friends set phone='"+phone+"',email='"+email+"',workPlace='"+workPlace+"',place='"+place+"',QQ='"+QQ+"' where name='"+name+"'and userName='"+userName+"'"; 79 | stmt.executeUpdate(sql1); 80 | String sql2="select * from friends where userName='"+userName+"'"; 81 | rs=stmt.executeQuery(sql2); 82 | ArrayList friendslist=null; 83 | friendslist=new ArrayList(); 84 | while(rs.next()){ 85 | LookFriendBean ff=new LookFriendBean(); 86 | ff.setName(rs.getString("name")); 87 | ff.setPhone(rs.getString("phone")); 88 | ff.setEmail(rs.getString("email")); 89 | ff.setWorkPlace(rs.getString("workPlace")); 90 | ff.setPlace(rs.getString("place")); 91 | ff.setQQ(rs.getString("QQ")); 92 | friendslist.add(ff); 93 | session.setAttribute("friendslist", friendslist); 94 | } 95 | rs.close(); 96 | stmt.close(); 97 | con.close(); 98 | right(); 99 | response.sendRedirect("http://localhost:8084/PIMS/LookFriendServlet"); 100 | }catch(Exception e){ 101 | e.printStackTrace(); 102 | } 103 | } 104 | } 105 | 106 | @Override 107 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 108 | throws ServletException, IOException { 109 | doGet(request, response); 110 | } 111 | } -------------------------------------------------------------------------------- /src/friendManager/AddFriendServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package friendManager; 6 | 7 | import java.io.IOException; 8 | import java.sql.*; 9 | import java.util.ArrayList; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | import javax.swing.JOptionPane; 16 | import loginRegister.LoginBean; 17 | 18 | /** 19 | * 20 | * @author Administrator 21 | */ 22 | public class AddFriendServlet extends HttpServlet { 23 | public void wrong1(){ 24 | String msg="不允许有空,添加失败!"; 25 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 26 | String title="信息提示"; 27 | JOptionPane.showMessageDialog(null, msg, title, type); 28 | } 29 | public void wrong2(){ 30 | String msg="用户名已存在,添加失败!"; 31 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 32 | String title="信息提示"; 33 | JOptionPane.showMessageDialog(null, msg, title, type); 34 | } 35 | public void right(){ 36 | String msg="填写信息合格,添加成功!"; 37 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 38 | String title="信息提示"; 39 | JOptionPane.showMessageDialog(null, msg, title, type); 40 | } 41 | @Override 42 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 43 | throws ServletException, IOException { 44 | String name=new String(request.getParameter("name").getBytes("ISO-8859-1"),"UTF-8"); 45 | String phone=new String(request.getParameter("phone").getBytes("ISO-8859-1"),"UTF-8"); 46 | String email=new String(request.getParameter("email").getBytes("ISO-8859-1"),"UTF-8"); 47 | String workPlace=new String(request.getParameter("workPlace").getBytes("ISO-8859-1"),"UTF-8"); 48 | String place=new String(request.getParameter("place").getBytes("ISO-8859-1"),"UTF-8"); 49 | String QQ=new String(request.getParameter("QQ").getBytes("ISO-8859-1"),"UTF-8"); 50 | if(name.length()==0||phone.length()==0||email.length()==0||workPlace.length()==0||QQ.length()==0){ 51 | wrong1(); 52 | response.sendRedirect("http://localhost:8084/PIMS/friendManager/addFriend.jsp"); 53 | }else{ 54 | try{ 55 | Connection con=null; 56 | Statement stmt=null; 57 | ResultSet rs=null; 58 | Class.forName("com.mysql.jdbc.Driver"); 59 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 60 | con=DriverManager.getConnection(url,"root","123456"); 61 | stmt=con.createStatement(); 62 | String userName=""; 63 | HttpSession session=request.getSession(); 64 | ArrayList login=(ArrayList)session.getAttribute("login"); 65 | if(login==null||login.size()==0){ 66 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 67 | }else{ 68 | for(int i=login.size()-1;i>=0;i--){ 69 | LoginBean nn=(LoginBean)login.get(i); 70 | userName=nn.getUserName(); 71 | } 72 | } 73 | String sql1="select * from friends where name='"+name+"'and userName='"+userName+"'"; 74 | rs=stmt.executeQuery(sql1); 75 | rs.last(); 76 | int k; 77 | k=rs.getRow(); 78 | if(k>0){ 79 | wrong2(); 80 | response.sendRedirect("http://localhost:8084/PIMS/friendManager/addFriend.jsp"); 81 | }else{ 82 | String sql2="insert into friends"+"(userName,name,phone,email,workPlace,place,QQ)"+"values("+"'"+userName+"'"+","+"'"+name+"'"+","+"'"+phone+"'"+","+"'"+email+"'"+","+"'"+workPlace+"'"+","+"'"+place+"'"+","+"'"+QQ+"'"+")"; 83 | stmt.executeUpdate(sql2); 84 | } 85 | String sql3="select * from friends where userName='"+userName+"'"; 86 | rs=stmt.executeQuery(sql3); 87 | ArrayList friendslist=null; 88 | friendslist=new ArrayList(); 89 | while(rs.next()){ 90 | LookFriendBean ff=new LookFriendBean(); 91 | ff.setName(rs.getString("name")); 92 | ff.setPhone(rs.getString("phone")); 93 | ff.setEmail(rs.getString("email")); 94 | ff.setWorkPlace(rs.getString("workPlace")); 95 | ff.setPlace(rs.getString("place")); 96 | ff.setQQ(rs.getString("QQ")); 97 | friendslist.add(ff); 98 | session.setAttribute("friendslist", friendslist); 99 | } 100 | rs.close(); 101 | stmt.close(); 102 | con.close(); 103 | right(); 104 | response.sendRedirect("http://localhost:8084/PIMS/friendManager/lookFriend.jsp"); 105 | }catch(Exception e){ 106 | e.printStackTrace(); 107 | } 108 | } 109 | } 110 | 111 | @Override 112 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 113 | throws ServletException, IOException { 114 | doGet(request, response); 115 | } 116 | 117 | } -------------------------------------------------------------------------------- /web/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | login.jsp 5 | 6 | 7 | 8 | LoginServlet 9 | loginRegister.LoginServlet 10 | 11 | 12 | RegisterServlet 13 | loginRegister.RegisterServlet 14 | 15 | 16 | LookMessageServlet 17 | lookMessage.LookMessageServlet 18 | 19 | 20 | UpdateMessageServlet 21 | lookMessage.UpdateMessageServlet 22 | 23 | 24 | UpdatePasswordServlet 25 | lookMessage.UpdatePasswordServlet 26 | 27 | 28 | LookFriendServlet 29 | friendManager.LookFriendServlet 30 | 31 | 32 | AddFriendServlet 33 | friendManager.AddFriendServlet 34 | 35 | 36 | UpdateFriendServlet 37 | friendManager.UpdateFriendServlet 38 | 39 | 40 | UpdateFriendMessageServlet 41 | friendManager.UpdateFriendMessageServlet 42 | 43 | 44 | DeleteFriendServlet 45 | friendManager.DeleteFriendServlet 46 | 47 | 48 | LookDateServlet 49 | dateManager.LookDateServlet 50 | 51 | 52 | AddDateServlet 53 | dateManager.AddDateServlet 54 | 55 | 56 | UpdateDateServlet 57 | dateManager.UpdateDateServlet 58 | 59 | 60 | DeleteDateServlet 61 | dateManager.DeleteDateServlet 62 | 63 | 64 | FileUpServlet 65 | fileManager.FileUpServlet 66 | 67 | 68 | LoginServlet 69 | /LoginServlet 70 | 71 | 72 | RegisterServlet 73 | /RegisterServlet 74 | 75 | 76 | LookMessageServlet 77 | /LookMessageServlet 78 | 79 | 80 | UpdateMessageServlet 81 | /UpdateMessageServlet 82 | 83 | 84 | UpdatePasswordServlet 85 | /UpdatePasswordServlet 86 | 87 | 88 | LookFriendServlet 89 | /LookFriendServlet 90 | 91 | 92 | AddFriendServlet 93 | /AddFriendServlet 94 | 95 | 96 | UpdateFriendServlet 97 | /UpdateFriendServlet 98 | 99 | 100 | UpdateFriendMessageServlet 101 | /UpdateFriendMessageServlet 102 | 103 | 104 | DeleteFriendServlet 105 | /DeleteFriendServlet 106 | 107 | 108 | LookDateServlet 109 | /LookDateServlet 110 | 111 | 112 | AddDateServlet 113 | /AddDateServlet 114 | 115 | 116 | UpdateDateServlet 117 | /UpdateDateServlet 118 | 119 | 120 | DeleteDateServlet 121 | /DeleteDateServlet 122 | 123 | 124 | FileUpServlet 125 | /FileUpServlet 126 | 127 | 128 | 129 | 30 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /src/dateManager/DeleteDateServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package dateManager; 6 | 7 | import java.io.IOException; 8 | import java.sql.*; 9 | import java.util.ArrayList; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | import javax.swing.JOptionPane; 16 | import loginRegister.LoginBean; 17 | 18 | /** 19 | * 20 | * @author Administrator 21 | */ 22 | public class DeleteDateServlet extends HttpServlet { 23 | public void wrong1(){ 24 | String msg="请把日期填写完整,删除失败!"; 25 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 26 | String title="信息提示"; 27 | JOptionPane.showMessageDialog(null, msg, title, type); 28 | } 29 | public void wrong2(){ 30 | String msg="请确认日期填写正确,删除失败!"; 31 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 32 | String title="信息提示"; 33 | JOptionPane.showMessageDialog(null, msg, title, type); 34 | } 35 | public void wrong3(){ 36 | String msg="该日程不存在,删除失败!"; 37 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 38 | String title="信息提示"; 39 | JOptionPane.showMessageDialog(null, msg, title, type); 40 | } 41 | public void right(){ 42 | String msg="填写信息合格,删除成功!"; 43 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 44 | String title="信息提示"; 45 | JOptionPane.showMessageDialog(null, msg, title, type); 46 | } 47 | @Override 48 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 49 | throws ServletException, IOException { 50 | String year=new String(request.getParameter("year").getBytes("ISO-8859-1"),"UTF-8"); 51 | String month=new String(request.getParameter("month").getBytes("ISO-8859-1"),"UTF-8"); 52 | String day=new String(request.getParameter("day").getBytes("ISO-8859-1"),"UTF-8"); 53 | String date="20"+year+"-"+month+"-"+year; 54 | if(year.length()==0||month.length()==0||day.length()==0){ 55 | wrong1(); 56 | response.sendRedirect("http://localhost:8084/PIMS/dateManager/deleteDate.jsp"); 57 | }else if(year.length()!=2||Integer.parseInt(year)<11||Integer.parseInt(month)>12||Integer.parseInt(day)>31){ 58 | wrong2(); 59 | response.sendRedirect("http://localhost:8084/PIMS/dateManager/deleteDate.jsp"); 60 | }else{ 61 | try{ 62 | Connection con=null; 63 | Statement stmt=null; 64 | ResultSet rs=null; 65 | Class.forName("com.mysql.jdbc.Driver"); 66 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 67 | con=DriverManager.getConnection(url,"root","123456"); 68 | stmt=con.createStatement(); 69 | String userName=""; 70 | HttpSession session=request.getSession(); 71 | ArrayList login=(ArrayList)session.getAttribute("login"); 72 | if(login==null||login.size()==0){ 73 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 74 | }else{ 75 | for(int i=login.size()-1;i>=0;i--){ 76 | LoginBean nn=(LoginBean)login.get(i); 77 | userName=nn.getUserName(); 78 | } 79 | } 80 | String sql1="select * from date where date='"+date+"'and userName='"+userName+"'"; 81 | rs=stmt.executeQuery(sql1); 82 | rs.last(); 83 | int k; 84 | k=rs.getRow(); 85 | rs.beforeFirst(); 86 | if(k<1){ 87 | wrong3(); 88 | response.sendRedirect("http://localhost:8084/PIMS/dateManager/deleteDate.jsp"); 89 | }else{ 90 | String sql2="delete from date where date='"+date+"'and userName='"+userName+"'"; 91 | stmt.executeUpdate(sql2); 92 | String sql3="select * from date where userName='"+userName+"'"; 93 | rs=stmt.executeQuery(sql3); 94 | rs.last(); 95 | int list=rs.getRow(); 96 | rs.beforeFirst(); 97 | if(list<1){ 98 | ArrayList datelist=null; 99 | session.setAttribute("datelist", datelist); 100 | }else{ 101 | ArrayList datelist=null; 102 | datelist=new ArrayList(); 103 | while(rs.next()){ 104 | LookDateBean dd=new LookDateBean(); 105 | dd.setDate(rs.getString("date")); 106 | dd.setThing(rs.getString("thing")); 107 | datelist.add(dd); 108 | session.setAttribute("datelist", datelist); 109 | } 110 | } 111 | rs.close(); 112 | stmt.close(); 113 | con.close(); 114 | right(); 115 | response.sendRedirect("http://localhost:8084/PIMS/dateManager/lookDate.jsp"); 116 | } 117 | rs.close(); 118 | stmt.close(); 119 | con.close(); 120 | }catch(Exception e){ 121 | e.printStackTrace(); 122 | } 123 | } 124 | } 125 | 126 | @Override 127 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 128 | throws ServletException, IOException { 129 | doGet(request, response); 130 | } 131 | 132 | } -------------------------------------------------------------------------------- /src/dateManager/UpdateDateServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package dateManager; 6 | 7 | import java.io.IOException; 8 | import java.sql.*; 9 | import java.util.ArrayList; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | import javax.swing.JOptionPane; 16 | import loginRegister.LoginBean; 17 | 18 | /** 19 | * 20 | * @author Administrator 21 | */ 22 | public class UpdateDateServlet extends HttpServlet { 23 | public void wrong1(){ 24 | String msg="请把日期填写完整,修改失败!"; 25 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 26 | String title="信息提示"; 27 | JOptionPane.showMessageDialog(null, msg, title, type); 28 | } 29 | public void wrong2(){ 30 | String msg="请确认日期填写正确,修改失败!"; 31 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 32 | String title="信息提示"; 33 | JOptionPane.showMessageDialog(null, msg, title, type); 34 | } 35 | public void wrong3(){ 36 | String msg="请填写日程内容,修改失败!"; 37 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 38 | String title="信息提示"; 39 | JOptionPane.showMessageDialog(null, msg, title, type); 40 | } 41 | public void wrong4(){ 42 | String msg="该日程不存在,修改失败!"; 43 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 44 | String title="信息提示"; 45 | JOptionPane.showMessageDialog(null, msg, title, type); 46 | } 47 | public void right(){ 48 | String msg="填写信息合格,修改成功!"; 49 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 50 | String title="信息提示"; 51 | JOptionPane.showMessageDialog(null, msg, title, type); 52 | } 53 | @Override 54 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 55 | throws ServletException, IOException { 56 | String year=new String(request.getParameter("year").getBytes("ISO-8859-1"),"UTF-8"); 57 | String month=new String(request.getParameter("month").getBytes("ISO-8859-1"),"UTF-8"); 58 | String day=new String(request.getParameter("day").getBytes("ISO-8859-1"),"UTF-8"); 59 | String thing=new String(request.getParameter("thing").getBytes("ISO-8859-1"),"UTF-8"); 60 | String date="20"+year+"-"+month+"-"+year; 61 | if(year.length()==0||month.length()==0||day.length()==0){ 62 | wrong1(); 63 | response.sendRedirect("http://localhost:8084/dateManager/updateDate.jsp"); 64 | }else if(year.length()!=2||Integer.parseInt(year)<11||Integer.parseInt(month)<1||Integer.parseInt(month)>12||Integer.parseInt(day)<1||Integer.parseInt(day)>31){ 65 | wrong2(); 66 | response.sendRedirect("http://localhost:8084/dateManager/updateDate.jsp"); 67 | }else if(thing.length()==0){ 68 | wrong3(); 69 | response.sendRedirect("http://localhost:8084/dateManager/updateDate.jsp"); 70 | }else{ 71 | try{ 72 | Connection con=null; 73 | Statement stmt=null; 74 | ResultSet rs=null; 75 | Class.forName("com.mysql.jdbc.Driver"); 76 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 77 | con=DriverManager.getConnection(url,"root","123456"); 78 | stmt=con.createStatement(); 79 | String userName=""; 80 | HttpSession session=request.getSession(); 81 | ArrayList login=(ArrayList)session.getAttribute("login"); 82 | if(login==null||login.size()==0){ 83 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 84 | }else{ 85 | for(int i=login.size()-1;i>=0;i--){ 86 | LoginBean nn=(LoginBean)login.get(i); 87 | userName=nn.getUserName(); 88 | } 89 | } 90 | String sql1="select * from date where date='"+date+"'and userName='"+userName+"'"; 91 | rs=stmt.executeQuery(sql1); 92 | rs.last(); 93 | int k; 94 | k=rs.getRow(); 95 | rs.beforeFirst(); 96 | if(k<1){ 97 | wrong4(); 98 | response.sendRedirect("http://localhost:8084/dateManager/updateDate.jsp"); 99 | }else{ 100 | String sql2="update date set thing='"+thing+"' where date='"+date+"'and userName='"+userName+"'"; 101 | stmt.executeUpdate(sql2); 102 | String sql3="select * from date where userName='"+userName+"'"; 103 | rs=stmt.executeQuery(sql3); 104 | ArrayList datelist=new ArrayList(); 105 | while(rs.next()){ 106 | LookDateBean dd=new LookDateBean(); 107 | dd.setDate(rs.getString("date")); 108 | dd.setThing(rs.getString("thing")); 109 | datelist.add(dd); 110 | session.setAttribute("datelist", datelist); 111 | } 112 | rs.close(); 113 | stmt.close(); 114 | con.close(); 115 | right(); 116 | response.sendRedirect("http://localhost:8084/PIMS/dateManager/lookDate.jsp"); 117 | } 118 | rs.close(); 119 | stmt.close(); 120 | con.close(); 121 | }catch(Exception e){ 122 | e.printStackTrace(); 123 | } 124 | } 125 | } 126 | 127 | @Override 128 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 129 | throws ServletException, IOException { 130 | doGet(request, response); 131 | } 132 | 133 | } -------------------------------------------------------------------------------- /src/dateManager/AddDateServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package dateManager; 6 | 7 | import loginRegister.LoginBean; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.http.HttpServlet; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | import javax.servlet.http.HttpSession; 14 | import javax.swing.*; 15 | import java.io.IOException; 16 | import java.sql.Connection; 17 | import java.sql.DriverManager; 18 | import java.sql.ResultSet; 19 | import java.sql.Statement; 20 | import java.util.ArrayList; 21 | 22 | /** 23 | * 24 | * @author Administrator 25 | */ 26 | public class AddDateServlet extends HttpServlet { 27 | public void wrong1(){ 28 | String msg="请把日期填写完整,添加失败!"; 29 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 30 | String title="信息提示"; 31 | JOptionPane.showMessageDialog(null, msg, title, type); 32 | } 33 | public void wrong2(){ 34 | String msg="请确认日期填写正确,添加失败!"; 35 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 36 | String title="信息提示"; 37 | JOptionPane.showMessageDialog(null, msg, title, type); 38 | } 39 | public void wrong3(){ 40 | String msg="请填写日程内容,添加失败!"; 41 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 42 | String title="信息提示"; 43 | JOptionPane.showMessageDialog(null, msg, title, type); 44 | } 45 | public void wrong4(){ 46 | String msg="该日程已有计划,添加失败!"; 47 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 48 | String title="信息提示"; 49 | JOptionPane.showMessageDialog(null, msg, title, type); 50 | } 51 | public void right(){ 52 | String msg="填写信息合格,添加成功!"; 53 | int type=JOptionPane.YES_NO_CANCEL_OPTION; 54 | String title="信息提示"; 55 | JOptionPane.showMessageDialog(null, msg, title, type); 56 | } 57 | @Override 58 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 59 | throws ServletException, IOException { 60 | String year=new String(request.getParameter("year").getBytes("ISO-8859-1"),"UTF-8"); 61 | String month=new String(request.getParameter("month").getBytes("ISO-8859-1"),"UTF-8"); 62 | String day=new String(request.getParameter("day").getBytes("ISO-8859-1"),"UTF-8"); 63 | String thing=new String(request.getParameter("thing").getBytes("ISO-8859-1"),"UTF-8"); 64 | String date="20"+year+"-"+month+"-"+year; 65 | if(year.length()==0||month.length()==0||day.length()==0){ 66 | wrong1(); 67 | response.sendRedirect("http://localhost:8084/PIMS/dateManager/addDate.jsp"); 68 | }else if(year.length()!=2||Integer.parseInt(year)<11||Integer.parseInt(month)<1||Integer.parseInt(month)>12||Integer.parseInt(day)<1||Integer.parseInt(day)>31){ 69 | wrong2(); 70 | response.sendRedirect("http://localhost:8084/PIMS/dateManager/addDate.jsp"); 71 | }else if(thing.length()==0){ 72 | wrong3(); 73 | response.sendRedirect("http://localhost:8084/PIMS/dateManager/addDate.jsp"); 74 | }else{ 75 | try{ 76 | Connection con=null; 77 | Statement stmt=null; 78 | ResultSet rs=null; 79 | Class.forName("com.mysql.jdbc.Driver"); 80 | String url="jdbc:mysql://localhost:3306/no204_person?useUnicode=true&characterEncoding=gbk"; 81 | con=DriverManager.getConnection(url,"root","123456"); 82 | stmt=con.createStatement(); 83 | String userName=""; 84 | HttpSession session=request.getSession(); 85 | ArrayList login=(ArrayList)session.getAttribute("login"); 86 | if(login==null||login.size()==0){ 87 | response.sendRedirect("http://localhost:8084/PIMS/login.jsp"); 88 | }else{ 89 | for(int i=login.size()-1;i>=0;i--){ 90 | LoginBean nn=(LoginBean)login.get(i); 91 | userName=nn.getUserName(); 92 | } 93 | } 94 | String sql1="select * from date where date='"+date+"'and userName='"+userName+"'"; 95 | rs=stmt.executeQuery(sql1); 96 | rs.last(); 97 | int k; 98 | k=rs.getRow(); 99 | rs.beforeFirst(); 100 | if(k>0){ 101 | wrong4(); 102 | response.sendRedirect("http://localhost:8084/PIMS/dateManager/addDate.jsp"); 103 | }else{ 104 | String sql2="insert into date"+"(userName,date,thing)"+"values("+"'"+userName+"'"+","+"'"+date+"'"+","+"'"+thing+"'"+")"; 105 | stmt.executeUpdate(sql2); 106 | String sql3="select * from date where userName='"+userName+"'"; 107 | rs=stmt.executeQuery(sql3); 108 | ArrayList datelist=null; 109 | datelist=new ArrayList(); 110 | while(rs.next()){ 111 | LookDateBean dd=new LookDateBean(); 112 | dd.setDate(rs.getString("date")); 113 | dd.setThing(rs.getString("thing")); 114 | datelist.add(dd); 115 | session.setAttribute("datelist", datelist); 116 | } 117 | } 118 | rs.close(); 119 | stmt.close(); 120 | con.close(); 121 | right(); 122 | response.sendRedirect("http://localhost:8084/PIMS/dateManager/lookDate.jsp"); 123 | }catch(Exception e){ 124 | e.printStackTrace(); 125 | } 126 | } 127 | } 128 | 129 | @Override 130 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 131 | throws ServletException, IOException { 132 | doGet(request, response); 133 | } 134 | 135 | } -------------------------------------------------------------------------------- /web/lookMessage/updateMessage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : updateMessage 3 | Created on : 2012-3-20, 23:30:55 4 | Author : Administrator 5 | --%> 6 | 7 | <%@page import="lookMessage.LookMessageBean"%> 8 | <%@page import="java.util.ArrayList"%> 9 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 10 | 11 | 12 | 13 | 14 | 个人信息管理系统->查看 15 | 16 | 17 |
18 |
19 | 20 | 21 | 22 | 25 | 28 | 29 |
修改个人信息 23 | 查看个人信息 24 | 26 | 修改密码 27 |
30 |
31 |
32 |

33 |
34 | 35 | <% 36 | ArrayList wordlist=(ArrayList)session.getAttribute("wordlist"); 37 | if(wordlist==null||wordlist.size()==0){ 38 | response.sendRedirect("http://localhost:8084/PIMS/main/bottom.jsp"); 39 | }else{ 40 | for(int i=wordlist.size()-1;i>=0;i--){ 41 | LookMessageBean mm=(LookMessageBean)wordlist.get(i); 42 | %> 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 110 | 111 | 112 | 113 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 180 | 181 | <% 182 | } 183 | } 184 | %> 185 |
用户姓名<%=mm.getName()%>
用户性别<%=mm.getSex()%>
出生日期<%=mm.getBirth()%>
用户民族<%=mm.getNation()%>
用户学历 62 | 109 |
用户类型 114 | 161 |
用户电话
家庭住址<%=mm.getPlace()%>
邮箱地址
177 |       178 | 179 |
186 |
187 | 188 | 189 | 190 | -------------------------------------------------------------------------------- /web/register/register.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : register 3 | Created on : 2012-3-20, 21:19:20 4 | Author : Administrator 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | 个人信息管理系统--注册页面 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 259 | 260 |
18 |

请填写以下注册信息

19 |
23 |
24 | 25 | 26 | 29 | 32 | 33 | 34 | 37 | 40 | 41 | 42 | 45 | 48 | 49 | 50 | 53 | 56 | 57 | 58 | 61 | 65 | 66 | 67 | 70 | 142 | 143 | 144 | 147 | 153 | 154 | 155 | 158 | 170 | 171 | 172 | 175 | 188 | 189 | 190 | 193 | 196 | 197 | 198 | 201 | 241 | 242 | 243 | 246 | 249 | 250 | 251 | 255 | 256 |
27 | 登录名字 28 | 30 | 31 |
35 | 用户密码 36 | 38 | 39 |
43 | 重复密码 44 | 46 | 47 |
51 | 用户姓名 52 | 54 | 55 |
59 | 用户性别 60 | 62 | 男 63 | 女 64 |
68 | 出生日期 69 | 71 | 年 94 | 月 108 | 日 141 |
145 | 用户民族 146 | 148 | 汉族 149 | 回族 150 | 壮族 151 | 其它 152 |
156 | 用户学历 157 | 159 | 169 |
173 | 用户类型 174 | 176 | 187 |
191 | 用户电话 192 | 194 | 195 |
199 | 家庭住址 200 | 202 | 省(直辖市) 240 |
244 | 邮箱地址 245 | 247 | 248 |
252 |       253 | 254 |
257 |
258 |
261 | 262 | 263 | --------------------------------------------------------------------------------