JavaWeb课程设计汇本~~~客户管理系统

上传人:无*** 文档编号:93019036 上传时间:2022-05-19 格式:DOC 页数:33 大小:1.95MB
收藏 版权申诉 举报 下载
JavaWeb课程设计汇本~~~客户管理系统_第1页
第1页 / 共33页
JavaWeb课程设计汇本~~~客户管理系统_第2页
第2页 / 共33页
JavaWeb课程设计汇本~~~客户管理系统_第3页
第3页 / 共33页
资源描述:

《JavaWeb课程设计汇本~~~客户管理系统》由会员分享,可在线阅读,更多相关《JavaWeb课程设计汇本~~~客户管理系统(33页珍藏版)》请在装配图网上搜索。

1、 枣 庄 学 院信息科学与工程学院课程设计任务书 题 目:客户信息管理系统姓 名: 桑得水 学 号: 201212140421 专业班级: 网络工程物联网 课 程: Java Web 指导教师: 钢 职称: 讲 师 完成时间: 2014年 5 月-2014年 6月枣庄学院信息科学与工程学院制2014年6 月20日29 / 33课程设计任务书及成绩评定课程设计的任务和具体要求课程设计要求设计一个用Java Web开发基于B/S架构的管理系统,页面至少6个以上,应能反响出学生综合利用Java Web知识和数据库知识完成一定的设计任务的能力,反映出学生理论联系实践的动手能力。具体要求如下:1明确所要

2、开发系统的设计任务;2做好需求分析,合理选择设计方案;3页面静态局部可用Dreamweaver开发实现4动态页面局部可用JSP、Servlet、JavaBean等实现;5后台数据库可采用MySQL、Oracle、SQL Server等实现;6在编写程序过程中应注意相关文档的编写;7认真撰写课程设计总结报告。指导教师签字:_ 日期:指导教师评语成绩:_指导教师签字: 日期:课程设计所需软件、硬件等n 硬件环境: CPU,主频1GHz以上;存512M以上;硬盘30G以上;1024768显示分辨率n 软件环境: Microsoft windows XP或以上版本 ; eclipse; JDK1.6;

3、 Tomcat6.0; MySQL课程设计进度方案起至日期工作容备注参考文献、资料索引序号文献、资料名称编著者出版单位1 应逵. Java Web数据库系统应用开发与实例.:人民邮电,2009目 录一、 前言1二、 课程设计容与目标2三、 系统设计23.1 系统特点23.2 功能设计23.3 用户界面草图33.4 页面迁移图43.5 页面功能设计5四、 数据库设计64.1 数据库表64.2 数据库操作图7五、 功能模块的详细设计85.1 程序目录构造图85.2 数据库访问模块85.3 共通Servlet的处理95.4 登录模块145.5 页面导航设计155.6 客户资料维护模块175.7 客户

4、来电信息模块235.8 客户回访信息模块255.9 客户重要信息提示模块27六、 对本系统开发的思考总结29一课程设计目的课程设计是一项重要的实践性教学环节,在教师的指导下,以学生为中心,充分调动学生的积极性和能动性,重视学生自学能力的培养。?Java Web 数据库系统应用开发与实例?是为教育技术学本科专业开设的专业选修课程,课程的主要目标是要求学生掌握根本的Web应用程序开发和设计的流程及相关的技术技能。本课程在讲解相关理论知识的根底上,按照一定的组织原那么和现有实验条件安排了一定数量的实验,通过这些实验使学生初步掌握开发和设计Web数据库系统的根本方法和根本技能。然而由于这些实验是分时分

5、批按一定的技术种类和实验目的实施的,固然可以有目的地训练和培养学生某个方面技能,但明显的不连续性使学生不能从整体上把握如何系统地开发和设计一个完整Web数据库系统应用程序。通过本课程设计可以较好地解决这个问题。通过本课程设计可以使学生充分认识开发和设计Web应用程序的的重要性和复杂性,充分了解Web应用程序的设计和开发的根本过程,掌握常用的Web开发技术,充分把握各项技术的特点和应用领域以及各项技术之间的相互关系,进一步体会各项技术在Web应用程序中地位和作用从而对各种技术有比拟清醒的认识,在此根底上习得Web开发技术平台的选择能力。二课程设计容与目标课题名称:客户信息管理系统设计目标:本系统

6、模拟企业对于客户信息的管理,操作人员可以添加、修改客户信息,针对客户来电进展记录,并对客户的重要信息进展提醒,等等。设计方法:jsp、mysql动态网页制作工具配合相关技术如HTML、CSS、JavaScript、xml等设计要求:利用Web应用程序的客户端开发技术包括Jsp、HTML、CSS、JavaScript、HTML、XML、MySql等设计一个符合要求的Java Web数据库应用系统,并实现用户交互功能的设计,到达Java Web应用程序可用性和易用性目标。开发模式:MVC模式。MVC模式的目的就是实现Web系统的职能分工。 Model层实现系统中的业务逻辑,通常可以用JavaBea

7、n或E来实现。 View层用于与用户的交互,通常用JSP来实现。 Controller层是Model与View之间沟通的桥梁,它可以分派用户的请求并选择恰当的视图以用于显示,同时它也可以解释用户的输入并将它们映射为模型层可执行的操作。开发工具:windows7,eclispe,jdk1.7,tomcat7.0、mysql5.5三、 系统设计1、系统特点 本系统尝试从一些简单的层面对于企业客户信息的管理进展一种探索,针对企业和客户的交流行为进展系统化管理,力求做到客户信息的准确、快捷和可追溯性。本系统包括3个主要层面,客户信息维护、客户来电记录和客户回访记录。2、功能设计4个模块(1)客户资料信

8、息维护模块 客户信息输入、修改和删除。(2)客户来电信息模块 来电信息添加和来电信息查询。(3)客户回访信息模块 回访信息添加和回访信息查询。(4) 客户重要信息提示模块用例图UseCase3、用户界面草图登录草图导航页面草图其它功能见后面操作效果图4、页面迁移图从页面迁移图中可以看出,本系统的页面迁移根本上发生在模块部,整体比拟简单而清晰5、页面功能设计所有页面的pageId和对应页面的Jsp文件名及所对应的功能四、 数据库设计1、数据库表1用户表user2客户信息表Customer3客户来电表 IneCall4客户回访表 FeedBackCall2、数据库操作图五、 功能模块的详细设计1、

9、程序目录构造图2、数据库访问模块 数据库的设计是需要针对每个模块而不是每个页面进展设置数据库模块,所有的数据访问类DUser、DIne、Dcustomer、DFeedback、DRemind从同一个父类Dmom继承,该父类提供了一个方法getDBConnection来获取数据库的。Dmon代码publicclass Dmonpublic Connection getDBConnection( ) /尝试连接数据库try /载入MySQL的JDBC驱动类 Class.forName(monConst.DB_DRIVER_CLASSNAME); Connectionconn=DriverManag

10、er.getConnection ( monConst.DB_CONN_STRING );/获得数据库连接return conn; catch(Exception ex) ex.printStackTrace();returnnull; 3、共通Servlet的处理 本系统中一旦代码出现了异常,将直接向上抛出,一直抛到共通类Servlet进展处理。 在共通Servlet中发现异常,将页面跳转到错误处理页面,并把错误信息在页面上显示出来,同时提供一个往登录页面迁移的。 对应的共通Servlet的相关代码如下:public class monServlet extends Servlet /保存各

11、页面Id对应的action类的对象 private Hashtable hPageHandler = new Hashtable(); /配置文件的存放位置 private JXPathContext configContext = null; public void init() /取得配置文件,并获得其中的dom元素 String filePath = getInitParameter(configXML); String fileRealPath = getServletContext().getRealPath(filePath); /尝试建立配置文件的DOM try org.jdom

12、.input.SAXBuilder builder = new SAXBuilder(); org.jdom.Document pDoc = builder.build(fileRealPath ); configContext = JXPathContext.newContext(pDoc); GlobalObjectProvider.init( configContext ); catch(Exception e) System.out.println(Servlet初始化失败!); /初始化共通类以获取页面信息 monConst.init(); /每一种动作第一次执行的时候,初始化对应的

13、类 public void doPost ( ServletRequest request, ServletResponse response ) throws ServletException, IOException /设置提交表单的中文编码 request.setCharacterEncoding(GBK); Session mySession = request.getSession(true); /得到用户输入信息 String sPageId = request.getParameter(pageId); String sActionId = request.getParamete

14、r(actionId); if ( sPageId = null | sPageId.equals() | sActionId = null | sActionId.equals() ) /非法进入页面,跳转到首页 mySession.invalidate(); response.sendRedirect(./login.jsp); return; /如果非法进入页面登录页面除外 if ( !sPageId.equals(S001) & mySession.getAttribute(loginUser) = null ) /非法进入页面,跳转到首页 mySession.invalidate()

15、; response.sendRedirect(./login.jsp); return; try /根据pageId获得处理对象,如果没有那么创立一个对象 Object oActionObject = hPageHandler.get( sPageId ); if ( oActionObject = null ) /根据配置文件创立一个新对象 String sClassName = (String)configContext.getValue( ch08-config/pageid=+sPageId+/className); oActionObject = Class.forName( sC

16、lassName ).newInstance(); hPageHandler.put( sPageId, oActionObject); /取得方法名 String sMethodName = (String)configContext.getValue( ch08-config/pageid=+sPageId+/actionid=+sActionId+/methodName); /生成对应的参数,并调用对应对象的对应方法 /inputData是根据传入的参数做成的 Hashtable inputData = new Hashtable(); Enumeration params = requ

17、est.getParameterNames(); while( params.hasMoreElements() String sParaName = (String)params.nextElement(); inputData.put( sParaName, request.getParameter(sParaName) ); /outputData是下一个页面的值域,在此只是被初始化 Hashtable outputData = new Hashtable(); /生成参数列表 Class paraType = Class.forName(java.util.Hashtable), Cl

18、ass.forName(java.util.Hashtable), Class.forName(javax.servlet. . Session) ; Object paraObj = inputData, outputData, mySession ; /生成Method对象 Method invokeMethod = oActionObject.getClass().getMethod( sMethodName, paraType ); /调用方法 invokeMethod.invoke( oActionObject, paraObj ); /根据outputData的结果断定下一个页面

19、String sNextPageId = (String)outputData.get(pageId); String sRealPagePath = (String)configContext.getValue( ch08-config/pageid=+sNextPageId+/path); /设置下一个页面的值域 mySession.setAttribute( sNextPageId, outputData ); response.sendRedirect( sRealPagePath ); return; catch(Exception e) /页面处理出错,跳转到错误处理页面 e.pr

20、intStackTrace(); Hashtable outputData = new Hashtable(); outputData.put( exception, e ); /设置错误页面的值域 mySession.setAttribute( monConst.VIEWID_ERROR, outputData ); response.sendRedirect(./error.jsp); return; public void doGet ( ServletRequest request, ServletResponse response ) throws ServletException,

21、 IOException doPost( request, response ); 错误页面:4、登录模块由于本系统用户角色只有一种,不存在跳转到不同页面的问题,处理相对简单一些,如果用户登录成功,那么将用户信息放到session中,并将页面跳转到导航页面。1登录页面控制模块ALogin相关代码如下:publicclass ALoginpublicvoid doLogin ( Hashtable inputData, Hashtable outputData, Session mySession )throws Exception /获取输入信息 String sUsername = (Str

22、ing)inputData.get(username); String sPassword = (String)inputData.get(password);/校验用户输入信息 LUser lUser = (LUser)GlobalObjectProvider.getLogicService(monConst.LOGIC_KEY_USER);/如果对应的类没有的话,报错并返回login页面if ( lUser = null ) thrownew Exception(发生了部错误,请联系技术人员! ); /获取用户信息 User userInfo = lUser.getUserInfo( sU

23、sername, sPassword );if ( userInfo = null ) outputData.put( pageId, monConst.VIEWID_LOGIN );outputData.put( errMsg, 用户名密码检查失败!请重新输入。 );outputData.put( username, sUsername );return; else outputData.put( pageId, monConst.VIEWID_MENU);/往session中设置用户信息 mySession.setAttribute( loginUser, userInfo );retur

24、n; (2) 登录效果图5、页面导航设计1页面位置信息和页面的pageid息息相关,考虑用一个全局变量来存这个信息,然后通过在共通文件中来访问这个全局变量来获取对应页面的名称。为了到达这个目的设置一个成员变量pageinfo和对应的设置方法init,对应代码如下:publicstaticHashtablepageInfos = newHashtable();/数据库相关常量publicstatic String DB_DRIVER_CLASSNAME = .mysql.jdbc.Driver;publicstatic String DB_CONN_STRING = jdbc:mysql:/lo

25、calhost/ch08?user=root&password=123; /初始化publicstaticvoid init() pageInfos.put(S002,目录页面);pageInfos.put(S110,客户资料 客户资料录入页面);pageInfos.put(S120,客户资料 客户资料修改一览页面);pageInfos.put(S121,客户资料 客户资料修改详细页面);pageInfos.put(S130,客户资料 客户资料删除页面);pageInfos.put(S210,客户来电 快速反响条件输入页面);pageInfos.put(S211,客户来电 快速反响结果一览页面

26、);pageInfos.put(S220,客户来电 客户来电信息添加页面);pageInfos.put(S230,客户来电 客户来电信息查找页面);pageInfos.put(S231,客户来电 客户来电信息一览页面);pageInfos.put(S232,客户来电 客户来电信息详细页面);pageInfos.put(S310,客户回访 客户回访信息添加页面);pageInfos.put(S320,客户回访 客户回访信息查找页面);pageInfos.put(S321,客户回访 客户回访信息一览页面);pageInfos.put(S322,客户回访 客户回访信息详细页面);pageInfos.

27、put(S410,客户重要信息提醒页面); /获得页面信息publicstatic String getPageInfo( String sPageId ) return (String)pageInfos.get(sPageId); 5.1页面外观设计 为四个模块设计不同颜色风格的CSS代码.tr_head1color:black; background-color:#aaccaa;.tr_content1color:black; background-color:#eeffee; cursor:hand;.tr_head2color:black; background-color:#cca

28、aaa;.tr_content2color:black; background-color:#ffeeee; cursor:hand;.tr_head3color:black; background-color:#aaaacc;.tr_content3color:black; background-color:#eeeeff; cursor:hand;.tr_head4color:black; background-color:#ccccaa;.tr_content4color:black; background-color:#ffffee; cursor:hand;5.2导航页效果图6、客户

29、资料维护模块(1) 客户资料录入 单击导航页面进入客户资料录入页面。注意两个方面:一是页面对应的显示元素和输入元素的颜色和当前模块的颜色想吻合,而是在用户输入信息并单击“登录按钮时,将客户信息登入数据库,然后页面直接转入修改一览。页面控制类ACustomerAdd:publicclass ACustomerAdd/追加一个客户publicvoid doRegister( Hashtable inputData, Hashtable outputData, Session mySession )throws Exception /首先获得要追加的客户详细信息 String sRealname =

30、 (String)inputData.get(realname); String sSex = (String)inputData.get(sex); String sBirthday = (String)inputData.get(birthday); String sPhone = (String)inputData.get(phone); String sCellphone = (String)inputData.get(cellphone); String sAddress = (String)inputData.get(address); String sStartDate = (S

31、tring)inputData.get(startDate); String sMemo = (String)inputData.get(memo);/生成一个Customer对象以调用 Customer customer = new Customer(); customer.setRealname( sRealname ); customer.setSex( sSex ); customer.setBirthday( sBirthday ); customer.setPhone( sPhone ); customer.setCellphone( sCellphone ); customer.

32、setAddress( sAddress ); customer.setStartDate( sStartDate ); customer.setMemo( sMemo );/调用对应的logic类 LCustomer lCustomer = (LCustomer)GlobalObjectProvider.getLogicService(monConst.LOGIC_KEY_CUSTOMER);/添加对应的记录 lCustomer.addCustomer( customer );/然后重新检索,并将页面迁移到一览页面Vector vCustomers = lCustomer.getAllCus

33、tomer();outputData.put( pageId, monConst.VIEWID_CUSTOMER_LIST);/往值域中设置当前位置信息 mySession.setAttribute(customers, vCustomers );outputData.put( pageIndex, new Integer(0) );return; 效果图:(2) 客户资料修改publicclass ACustomerModify/修改一个客户信息publicvoid doRegister( Hashtable inputData, Hashtable outputData, Session

34、mySession )throws Exception /首先获得要修改的客户详细信息 String sCustomerId = (String)inputData.get(customerId); String sRealname = (String)inputData.get(realname); String sSex = (String)inputData.get(sex); String sBirthday = (String)inputData.get(birthday); String sPhone = (String)inputData.get(phone); String s

35、Cellphone = (String)inputData.get(cellphone); String sAddress = (String)inputData.get(address); String sStartDate = (String)inputData.get(startDate); String sMemo = (String)inputData.get(memo);/生成一个Customer对象以调用 Customer customer = new Customer(); customer.setCustomerId( sCustomerId ); customer.setR

36、ealname( sRealname ); customer.setSex( sSex ); customer.setBirthday( sBirthday ); customer.setPhone( sPhone ); customer.setCellphone( sCellphone ); customer.setAddress( sAddress ); customer.setStartDate( sStartDate ); customer.setMemo( sMemo );/调用对应的logic类 LCustomer lCustomer = (LCustomer)GlobalObje

37、ctProvider.getLogicService(monConst.LOGIC_KEY_CUSTOMER);/添加对应的记录 lCustomer.modifyCustomer( customer );/然后重新检索,并将页面迁移到一览页面Vector vCustomers = lCustomer.getAllCustomer();outputData.put( pageId, monConst.VIEWID_CUSTOMER_LIST);/往值域中设置当前位置信息 mySession.setAttribute(customers, vCustomers );outputData.put(

38、pageIndex, new Integer(0) );return; (3) 客户资料删除publicclass ACustomerDelete/到首页publicvoid doFirst( Hashtable inputData, Hashtable outputData, Session mySession )throws Exception /首页的index一定为0outputData.put( pageId, monConst.VIEWID_CUSTOMER_DELETE);/往值域中设置当前位置信息outputData.put( pageIndex, new Integer(0)

39、 );return; /到末页publicvoid doLast( Hashtable inputData, Hashtable outputData, Session mySession )throws Exception /首先获得全部客户信息,并计算出最后一页的位置Vector allCustomers = (Vector)mySession.getAttribute(customers);int iMax = allCustomers.size();int iMaxPage = (int)Math.ceil(double)iMax/20);int iIndex = (iMaxPage-

40、1)*20;/首页的index一定为0outputData.put( pageId, monConst.VIEWID_CUSTOMER_DELETE);/往值域中设置当前位置信息outputData.put( pageIndex, new Integer(iIndex) );return; /到前页publicvoid doPrev( Hashtable inputData, Hashtable outputData, Session mySession )throws Exception /首先获得当前页 String sCurPage = (String)inputData.get(cur

41、Page);int iCurPage = (new Integer(sCurPage).intValue();int iIndex = (iCurPage-2)*20;outputData.put( pageId, monConst.VIEWID_CUSTOMER_DELETE);/往值域中设置当前位置信息outputData.put( pageIndex, new Integer(iIndex) );return; /到次页publicvoid doNext( Hashtable inputData, Hashtable outputData, Session mySession )thro

42、ws Exception /首先获得当前页 String sCurPage = (String)inputData.get(curPage);int iCurPage = (new Integer(sCurPage).intValue();int iIndex = iCurPage*20;outputData.put( pageId, monConst.VIEWID_CUSTOMER_DELETE);/往值域中设置当前位置信息outputData.put( pageIndex, new Integer(iIndex) );return; /到首页publicvoid doSpec( Hasht

43、able inputData, Hashtable outputData, Session mySession )throws Exception /首先获得指定页码 String sSpecPage = (String)inputData.get(spec);/获得全部客户信息,并计算出最后一页的位置Vector allCustomers = (Vector)mySession.getAttribute(customers);int iMax = allCustomers.size();int iMaxPage = (int)Math.ceil(double)iMax/20);int iSp

44、ec = (new Integer(sSpecPage).intValue();/如果指定页大于全部页码,那么跳转到第一页if ( iSpec iMaxPage ) iSpec = 1; /指定页outputData.put( pageId, monConst.VIEWID_CUSTOMER_DELETE);/往值域中设置当前位置信息outputData.put( pageIndex, new Integer(iSpec-1)*20) );return; /修改某条记录publicvoid doDelete( Hashtable inputData, Hashtable outputData,

45、 Session mySession )throws Exception /首先获得要修改的客户ID String sCustomerId = (String)inputData.get(customerId);/获得对应的客户的详细信息,然后迁移到客户详细信息修改页面/调用对应的logic类 LCustomer lCustomer = (LCustomer)GlobalObjectProvider.getLogicService(monConst.LOGIC_KEY_CUSTOMER);/删除对应的记录 lCustomer.deleteCustomerById( sCustomerId );

46、/然后重新检索,并定位到第一页Vector vCustomers = lCustomer.getAllCustomer();/由于需要在页面迁移中使用题库,所以放到session中 mySession.setAttribute( customers, vCustomers );/然后迁移到指定页面outputData.put( pageId, monConst.VIEWID_CUSTOMER_DELETE);/往值域中设置当前位置信息outputData.put( pageIndex, new Integer(0) );return; 7、客户来电信息模块快速反响页面的设计代码:publicc

47、lass AQuickCondition/追加一个客户publicvoid doSearch( Hashtable inputData, Hashtable outputData, Session mySession )throwsException /首先获得要查找的相关资料 String sCustomerId = (String)inputData.get(customerId); String sRealname = (String)inputData.get(realname); String sSex = (String)inputData.get(sex);if ( sSex =

48、 null ) sSex = ; String sPhone = (String)inputData.get(phone); String sStartDate = (String)inputData.get(startDate); String sIneDate = (String)inputData.get(ineDate); String sFeedbackDate = (String)inputData.get(feedbackDate);/调用对应的logic类 LCustomer lCustomer = (LCustomer)GlobalObjectProvider.getLogi

49、cService(monConst.LOGIC_KEY_CUSTOMER);/然后检索,并将页面迁移到一览页面Vector vCustomers = lCustomer.getCustomers( sCustomerId, sRealname, sSex, sPhone, sStartDate, sIneDate, sFeedbackDate);/检索出来了数据if ( vCustomers.size() 0 ) outputData.put( pageId, monConst.VIEWID_QUICK_LIST);/往值域中设置当前位置信息 mySession.setAttribute(cu

50、stomers, vCustomers );outputData.put( pageIndex, new Integer(0) ); else /重新显示条件录入页面outputData.put( customerId, sCustomerId );outputData.put( realname, sRealname );outputData.put( sex, sSex );outputData.put( phone, sPhone );outputData.put( startDate, sStartDate );outputData.put( ineDate, sIneDate );outputData.put( feedback, sFeedbackDate );outputData.put( pageId, monConst.VIEWID_QUICK_CONDITION);outputData.put( initMsg, 检索结果为0件,请重新指定查询条件! ); return; 8、客户回访信息模块publicclass AFeedbackCondition/

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

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!