java课程设计(通讯录管理系统).doc_第1页
java课程设计(通讯录管理系统).doc_第2页
java课程设计(通讯录管理系统).doc_第3页
java课程设计(通讯录管理系统).doc_第4页
java课程设计(通讯录管理系统).doc_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

安徽省巢湖学院计算机与信息工程学院课程设计报告课程名称 Java大学生实用教程 题目名称 通讯录管理系统 院(系) 计算机信息与工程学院 专业(班级) 10电子商务 姓名 朱禄城 学号 10011058 目 录一、设计题目1二、设计要求1三、总体设计13.1系统功能框架 13.2系统功能说明3四、详细设计3 1数据结构设计3 2系统模块设计10五、运行结果13一 设计题目随着社会的进步与发展,通讯越来越密切。希望能通过对java课程设计的学习和掌握来编写一个通讯录管理系统。二设计要求(1)只能使用Java语言,采用面向对象方法进行设计,要求源程序要有适当的注释,使程序容易阅读。(2)程序必须与数据库进行通信。(3)系统必须是图形用户界面的形式并连接数据库三. 总体设计3.1系统总体功能框架图通讯录管理系统按条查询全部查询用户数据统计功能用户数据删除功能用户数据查询功能用户数据增添功能系统管理登 录注册新用户录入数据库退出系统3.2 系统功能说明(1)具有新用户注册功能。(2)具有注册用户登录功能。(3)具有数据的录入功能。(4)具有数据查询功能,可以实现查询全部信息和按条件执行查询。(5)具有按条件删除数据功能。(6)具有统计功能4. 详细设计4.1数据结构设计(java程序设计)/登录系统package com.ibm.etp.addressbook.action;import java.util.HashMap;import java.util.List;import com.ibm.etp.addressbook.pojo.User;import com.ibm.etp.addressbook.service.LoginService;import com.opensymphony.xwork2.ActionSupport;public class LoginAction extends ActionSupport private static final long serialVersionUID = 1L;public String username;public String password;private String message;Overridepublic String execute() throws Exception HashMap result = new HashMap();List list = null;System.out.println(username);if(username = null | username.trim().length() = 0) result.put(success, false);result.put(msg, login.username.empty); else if(password = null | password.trim().length() = 0) result.put(success, false);result.put(msg, login.password.empty); else LoginService ls = new LoginService();list = ls.checkLogin(username);if(list = null) result.put(success, false);result.put(msg, error.user.not.exist); else if(list.get(0).getPassword().equals(password) result.put(success, true);result.put(msg, login.success); else result.put(success, false);result.put(msg, error.password.wrong);if(Boolean) result.get(success) message = (String) result.get(msg);return success; else message = (String) result.get(msg);return error;public String getMessage() return message;public void setMessage(String message) this.message = message;public void setUsername(String username) this.username = username;public void setPassword(String password) this.password = password;public String getUsername() return username;public String getPassword() return password;/增加记录package com.ibm.etp.addressbook.action;import java.util.HashMap;import java.util.List;import com.ibm.etp.addressbook.pojo.User;import com.ibm.etp.addressbook.service.LoginService;import com.opensymphony.xwork2.ActionSupport;public class LoginAction extends ActionSupport private static final long serialVersionUID = 1L;public String username;public String password;private String message;public String execute() throws Exception HashMap result = new HashMap();List list = null;System.out.println(username);if(username = null | username.trim().length() = 0) result.put(success, false);result.put(msg, login.username.empty); else if(password = null | password.trim().length() = 0) result.put(success, false);result.put(msg, login.password.empty); else LoginService ls = new LoginService();list = ls.checkLogin(username);if(list = null) result.put(success, false);result.put(msg, error.user.not.exist); else if(list.get(0).getPassword().equals(password) result.put(success, true);result.put(msg, login.success); else result.put(success, false);result.put(msg, error.password.wrong);if(Boolean) result.get(success) message = (String) result.get(msg);return success; else message = (String) result.get(msg);return error;public String getMessage() return message;public void setMessage(String message) this.message = message;public void setUsername(String username) this.username = username;public void setPassword(String password) this.password = password;public String getUsername() return username;public String getPassword() return password;/删除记录package com.ibm.etp.addressbook.action;import java.util.ArrayList;import com.ibm.etp.addressbook.pojo.Record;import com.ibm.etp.addressbook.service.DeleService;import com.opensymphony.xwork2.ActionSupport;public class DeleAction extends ActionSupport private int id;public String message;private boolean success=true;public boolean isSuccess() return success;private ArrayList list= new ArrayList();public ArrayList getList() return list;public int getId(int i)return idi;public int getId() return id;public void setId(int id) this.id = id;public String getMessage() return message;public void setMessage(String message) this.message = message;public String execute() throws Exception DeleService ds=new DeleService();list=ds.removeRecord(this);try success=true;return SUCCESS;catch (Exception e) success=false;return ERROR;/修改记录package com.ibm.etp.addressbook.action;import com.ibm.etp.addressbook.service.UpdateService;import com.opensymphony.xwork2.ActionSupport;public class UpdateAction extends ActionSupport private int id;private String name;private String phone;private String email;private String birthday;private String sex;public int getId() return id;public void setId(int id) this.id = id;public String getName() return name;public void setName(String name) = name;public String getPhone() return phone;public void setPhone(String phone) this.phone = phone;public String getEmail() return email;public void setEmail(String email) this.email = email;public String getBirthday() return birthday;public void setBirthday(String birthday) this.birthday = birthday;public String getSex() return sex;public void setSex(String sex) this.sex = sex;public String execute() throws Exception UpdateService us=new UpdateService();if(us.setRecord(this)!=null)return SUCCESS;elsereturn ERROR;/查找记录行package com.ibm.etp.addressbook.action;import java.sql.SQLException;import java.util.List;import com.ibm.etp.addressbook.pojo.Record;import com.ibm.etp.addressbook.service.FindService;import com.opensymphony.xwork2.ActionSupport;public class FindAction extends ActionSupport private String field;private String input;private int size;private String sort;private List list ;private boolean success=true;public boolean isSuccess() return success;public List getList() return list;public void setList(List list) this.list = list;public String getField() return field;public void setField(String field) this.field = field;public String getInput() return input;public void setInput(String input) this.input = input;public int getSize() return size;public void setSize(int size) this.size = size;public String getSort() return sort;public void setSort(String sort) this.sort = sort;public String execute() throws Exception FindAction fb = new FindAction();fb.setField(field);fb.setInput(input);fb.setSize(size);fb.setSort(sort);FindService fs = new FindService();try list = fs.find(fb); success=true;return SUCCESS; catch (SQLException e) e.printStackTrace(); success=false; return ERROR;4.2 系统模块设计图1-1登陆功能展示图 LoginAction类,封装的信息由密码和账户名,以及登录失败时抛出的异常方法。String execute()函数继承了Exception类,如果登录密码不匹配,则会抛出异常,提示Error登录失败。在登录模块中有管理员用户和普通用户,管理员可以对系统中的信息添加,修改,删除等功能,普通用户只进行查找操作。2、添加功能界面图2-1添加功

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论