JavaWeb课程设计 - 图文

更新时间:2024-01-28 21:18:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

JavaWeb 课程设计

题目:客户信息管理系统

专 业:计算机科学与技术 年 级:计091—3 学 号:200925501348 作 者:刘丹凤 指导老师:贺秉庚 完成时间:2012年6月17日

1

目录

JavaWeb 课程设计 .......................................................................................................................... 1

题目:客户信息管理系统 ....................................................................................................... 1 一.课程设计目的 ................................................................................................................... 3 二.课程设计内容与目标 ....................................................................................................... 4 三、 系统设计 ......................................................................................................................... 4

1、 系统特点 ................................................................................................................... 4 2、 功能设计 ................................................................................................................... 5 3、 用户界面草图 ........................................................................................................... 6 4、 页面迁移图 ............................................................................................................... 7 5、 页面功能设计 ........................................................................................................... 7 四、 数据库设计 ..................................................................................................................... 8

1、数据库表 ..................................................................................................................... 8 2、数据库操作图 ........................................................................................................... 10 五、 功能模块的详细设计 ................................................................................................... 11

1、程序目录结构图 ....................................................................................................... 11 2、数据库访问模块 ..................................................................................................... 11 3、 共通Servlet的处理 ............................................................................................... 12 4、 登录模块 ................................................................................................................. 16 5、 页面导航设计 ......................................................................................................... 17 5、 客户资料维护模块 ................................................................................................. 19 6、 客户来电信息模块 ................................................................................................. 26 7、 客户回访信息模块 ................................................................................................. 28 8、 客户重要信息提示模块 ......................................................................................... 30 六、 对本系统开发的思考总结 ........................................................................................... 33 七、 对软件开发方法的体会 ............................................................................................... 33

八、 自主创新声明 ....................................................................................................... 34 九、致谢 ......................................................................................................................... 34

2

一.课程设计目的

课程设计是一项重要的实践性教学环节,在教师的指导下,以学生为中心,充分调动学生的积极性和能动性,重视学生自学能力的培养。

《Java Web 数据库系统应用开发与实例》是为教育技术学本科专业开设的专业选修课程,课程的主要目标是要求学生掌握基本的Web应用程序开发和设计的流程及相关的技术技能。本课程在讲解相关理论知识的基础上,按照一定的组织原则和现有实验条件安排了一定数量的实验,通过这些实验使学生初步掌握开发和设计Web数据库系统的基本方法和基本技能。然而由于这些实验是分时分批按一定的技术种类和实验目的实施的,固然可以有目的地训练和培养学生某个方面技能,但明显的不连续性使学生不能从整体上把握如何系统地开发和设计一个完整Web数据库系统应用程序。通过本课程设计可以较好地解决这个问题。

通过本课程设计可以使学生充分认识开发和设计Web应用程序的的重要性和复杂性,充分了解Web应用程序的设计和开发的基本过程,掌握常用的Web开发技术,充分把握各项技术的特点和应用领域以及各项技术之间的相互关系,进一步体会各项技术在Web应用程序中地位和作用从而对各种技术有比较清醒的认识,在此基础上习得Web开发技术平台的选择能力。

3

二.课程设计内容与目标

课题名称:客户信息管理系统

设计目标:本系统模拟企业对于客户信息的管理,操作人员可以添加、修改客户信息,针对客户来电进行记录,并对客户的重要信息进行提醒,等等。

设计方法:jsp、mysql动态网页制作工具配合相关技术(如HTML、CSS、JavaScript、xml等)

设计要求:利用Web应用程序的客户端开发技术(包括Jsp、HTML、CSS、JavaScript、HTML、XML、MySql等)设计一个符合要求的Java Web数据库应用系统,并实现用户交互功能的设计,达到Java Web应用程序可用性和易用性目标。 开发模式:MVC

模式。MVC模式的目的就是实现Web系统的职能分工。

Model层实现系统中的业务逻辑,通常可以用JavaBean或EJB来实现。 View层用于与用户的交互,通常用JSP来实现。 Controller层是Model与View之间沟通的桥梁,它可以分派用户的请求并选择恰当的视图以用于显示,同时它也可以解释用户的输入并将它们映射为模型层可执行的操作。

开发工具:windows7,eclispe,jdk1.7,tomcat7.0、mysql5.5

三、系统设计

1、系统特点

本系统尝试从一些简单的层面对于企业客户信息的管理进行一

种探索,针对企业和客户的交流行为进行系统化管理,力求做到客户信息的准确、快捷和可追溯性。

本系统包括3个主要层面,客户信息维护、客户来电记录和客户回访记录。

4

2、功能设计

4个模块

(1)客户资料信息维护模块 客户信息输入、修改和删除。 (2)客户来电信息模块

来电信息添加和来电信息查询。 (3)客户回访信息模块

回访信息添加和回访信息查询。 (4)客户重要信息提示模块

用例图UseCase

5

3、用户界面草图

登录草图

导航页面草图

其它功能见后面操作效果图

6

4、页面迁移图

从页面迁移图中可以看出,本系统的页面迁移基本上发生在模块内部,整体比较简单而清晰

5、页面功能设计

所有页面的pageId和对应页面的Jsp文件名及所对应的功能

7

四、数据库设计

1、数据库表

(1)用户表user

(2)客户信息表Customer

8

(3)客户来电表 IncomeCall

(4)客户回访表 FeedBackCall

9

2、数据库操作图

10

五、功能模块的详细设计

1、程序目录结构图

2、数据库访问模块

数据库的设计是需要针对每个模块而不是每个页面进行设置数据库模块,所有的数据访问类DUser、DIncome、Dcustomer、DFeedback、DRemind从同一个父类Dcommom继承,该父类提供了一个方法getDBConnection来获取数据库的链接。

11

DCommon代码

public class DCommon {

public Connection getDBConnection( ) {//尝试连接数据库 try

{ //载入MySQL的JDBC驱动类

Class.forName(CommonConst.DB_DRIVER_CLASSNAME); Connectionconn=DriverManager.getConnection

( CommonConst.DB_CONN_STRING );//获得数据库连接

return conn; }

catch(Exception ex) {

ex.printStackTrace(); return null; } } }

3、共通Servlet的处理

本系统中一旦代码出现了异常,将直接向上抛出,一直抛到共通类

Servlet进行处理。

在共通Servlet中发现异常,将页面跳转到错误处理页面,并把错误信息在页面上显示出来,同时提供一个往登录页面迁移的链接。 对应的共通Servlet的相关代码如下:

public class CommonServlet extends HttpServlet {

//保存各页面Id对应的action类的对象

private Hashtable hPageHandler = new Hashtable();

//配置文件的存放位置

private JXPathContext configContext = null;

public void init() {

12

//取得配置文件,并获得其中的dom元素

String filePath = getInitParameter(\

String fileRealPath = getServletContext().getRealPath(filePath);

//尝试建立配置文件的DOM try {

org.jdom.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(\初始化失败!\ }

//初始化共通类以获取页面信息 CommonConst.init(); }

//每一种动作第一次执行的时候,初始化对应的类 public void doPost ( HttpServletRequest request,

HttpServletResponse response ) throws ServletException, IOException {

//设置提交表单的中文编码

request.setCharacterEncoding(\

HttpSession mySession = request.getSession(true);

//得到用户输入信息

String sPageId = request.getParameter(\ String sActionId = request.getParameter(\

if ( sPageId == null || sPageId.equals(\

|| sActionId == null || sActionId.equals(\ {

//非法进入页面,跳转到首页 mySession.invalidate();

response.sendRedirect(\ return;

13

}

//如果非法进入页面(登录页面除外) if ( !sPageId.equals(\

&& mySession.getAttribute(\ {

//非法进入页面,跳转到首页 mySession.invalidate();

response.sendRedirect(\ return; } try {

//根据pageId获得处理对象,如果没有则创建一个对象 Object oActionObject = hPageHandler.get( sPageId ); if ( oActionObject == null ) {

//根据配置文件创建一个新对象

String sClassName = (String)configContext.getValue(

\

oActionObject = Class.forName( sClassName ).newInstance(); hPageHandler.put( sPageId, oActionObject); }

//取得方法名

String sMethodName = (String)configContext.getValue(

\

//生成对应的参数,并调用对应对象的对应方法 //inputData是根据传入的参数做成的 Hashtable inputData = new Hashtable();

Enumeration params = request.getParameterNames(); while( params.hasMoreElements()) {

String sParaName = (String)params.nextElement();

inputData.put( sParaName, request.getParameter(sParaName) ); }

//outputData是下一个页面的值域,在此只是被初始化 Hashtable outputData = new Hashtable();

//生成参数列表

Class[] paraType = { Class.forName(\

14

Class.forName(\

Class.forName(\ Object[] paraObj = { inputData, outputData, mySession };

//生成Method对象

Method invokeMethod = oActionObject.getClass().getMethod( sMethodName, paraType );

//调用方法

invokeMethod.invoke( oActionObject, paraObj );

//根据outputData的结果决定下一个页面

String sNextPageId = (String)outputData.get(\ String sRealPagePath = (String)configContext.getValue(

\ //设置下一个页面的值域

mySession.setAttribute( sNextPageId, outputData ); response.sendRedirect( sRealPagePath ); return; }

catch(Exception e) {

//页面处理出错,跳转到错误处理页面 e.printStackTrace();

Hashtable outputData = new Hashtable(); outputData.put( \ //设置错误页面的值域

mySession.setAttribute( CommonConst.VIEWID_ERROR, outputData ); response.sendRedirect(\ return; } }

public void doGet ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {

doPost( request, response ); } }

错误页面:

15

4、登录模块

由于本系统用户角色只有一种,不存在跳转到不同页面的问题,处理相对简单一些,如果用户登录成功,则将用户信息放到session中,并将页面跳转到导航页面。

(1)登录页面控制模块ALogin相关代码如下:

public class ALogin {

public void doLogin ( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//获取输入信息

String sUsername = (String)inputData.get(\); String sPassword = (String)inputData.get(\);

//校验用户输入信息 LUser lUser = (LUser)GlobalObjectProvider.getLogicService(CommonConst.LOGIC_KEY_USER);

//如果对应的类没有的话,报错并返回login页面 if ( lUser == null ) {

16

throw new Exception(\发生了内部错误,请联系技术人员!\ ); }

//获取用户信息 User userInfo = lUser.getUserInfo( sUsername, sPassword ); if ( userInfo == null ) {

outputData.put( \, CommonConst.VIEWID_LOGIN ); outputData.put( \, \用户名密码检查失败!请重新输入。\ );

outputData.put( \, sUsername ); return; } else {

outputData.put( \, CommonConst.VIEWID_MENU);

//往session中设置用户信息

mySession.setAttribute( \, userInfo ); return; }

}

}

(2)登录效果图

5、页面导航设计

(1)页面位置信息和页面的pageid息息相关,考虑用一个全局变量来存这个信息,然后通过在共通文件中来访问这个全局变量来获取对应页面的名称。为了达到这个目的设置一个成员变量pageinfo和对应的设置方法init(),对应代码如下:

public static Hashtable pageInfos = new Hashtable();

//数据库相关常量 public static String DB_DRIVER_CLASSNAME \;

=

17

public static String DB_CONN_STRING = \;

//初始化

public static void init() {

pageInfos.put(\,\目录页面\); pageInfos.put(\,\客户资料 > 客户资料录入页面\); pageInfos.put(\,\客户资料 > 客户资料修改一览页面\); pageInfos.put(\,\客户资料 > 客户资料修改详细页面\); pageInfos.put(\,\客户资料 > 客户资料删除页面\); pageInfos.put(\,\客户来电 > 快速反应条件输入页面\); pageInfos.put(\,\客户来电 > 快速反应结果一览页面\); pageInfos.put(\,\客户来电 > 客户来电信息添加页面\); pageInfos.put(\,\客户来电 > 客户来电信息查找页面\); pageInfos.put(\,\客户来电 > 客户来电信息一览页面\); pageInfos.put(\,\客户来电 > 客户来电信息详细页面\); pageInfos.put(\,\客户回访 > 客户回访信息添加页面\); pageInfos.put(\,\客户回访 > 客户回访信息查找页面\); pageInfos.put(\,\客户回访 > 客户回访信息一览页面\); pageInfos.put(\,\客户回访 > 客户回访信息详细页面\); pageInfos.put(\,\客户重要信息提醒页面\); }

//获得页面信息

public static String getPageInfo( String sPageId ) {

return (String)pageInfos.get(sPageId);

}

(2)页面外观设计

为四个模块设计不同颜色风格的CSS代码

.tr_head1 {color: black; background-color:#aaccaa;} .tr_content1 {color: black; background-color:#eeffee; cursor:hand;}

.tr_head2 {color: black; background-color:#ccaaaa;} .tr_content2 {color: black; background-color:#ffeeee; cursor:hand;}

.tr_head3 {color: black; background-color:#aaaacc;} .tr_content3 {color: black; background-color:#eeeeff; cursor:hand;}

.tr_head4 {color: black; background-color:#ccccaa;} .tr_content4 {color: black; background-color:#ffffee;

18

cursor:hand;}

(3)导航页效果图

5、客户资料维护模块

(1)客户资料录入

单击导航页面链接进入客户资料录入页面。注意两个方面:一是页面对应的显示元素和输入元素的颜色和当前模块的颜色想吻合,而是在用户输入信息并单击“登录”按钮时,将客户信息登入数据库,然后页面直接转入修改一览。 页面控制类ACustomerAdd:

public class ACustomerAdd {

//追加一个客户

public void doRegister( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得要追加的客户详细信息

String sRealname = (String)inputData.get(\); String sSex = (String)inputData.get(\);

String sBirthday = (String)inputData.get(\);

19

String sPhone = (String)inputData.get(\);

String sCellphone = (String)inputData.get(\); String sAddress = (String)inputData.get(\); String sStartDate = (String)inputData.get(\); String sMemo = (String)inputData.get(\);

//生成一个Customer对象以调用

Customer customer = new Customer(); customer.setRealname( 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)GlobalObjectProvider.getLogicService(CommonConst.LOGIC_KEY_CUSTOMER);

//添加对应的记录

lCustomer.addCustomer( customer );

//然后重新检索,并将页面迁移到一览页面

Vector vCustomers = lCustomer.getAllCustomer();

outputData.put( \, CommonConst.VIEWID_CUSTOMER_LIST); //往值域中设置当前位置信息

mySession.setAttribute(\, vCustomers ); outputData.put( \, new Integer(0) ); return; } }

效果图:

20

(2)客户资料修改

public class ACustomerModify {

//修改一个客户信息

public void doRegister( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得要修改的客户详细信息 String sCustomerId = (String)inputData.get(\); String sRealname = (String)inputData.get(\); String sSex = (String)inputData.get(\);

String sBirthday = (String)inputData.get(\); String sPhone = (String)inputData.get(\);

String sCellphone = (String)inputData.get(\); String sAddress = (String)inputData.get(\); String sStartDate = (String)inputData.get(\); String sMemo = (String)inputData.get(\);

//生成一个Customer对象以调用

Customer customer = new Customer(); customer.setCustomerId( sCustomerId ); customer.setRealname( sRealname ); customer.setSex( sSex );

customer.setBirthday( sBirthday );

21

customer.setPhone( sPhone );

customer.setCellphone( sCellphone ); customer.setAddress( sAddress );

customer.setStartDate( sStartDate ); customer.setMemo( sMemo );

//调用对应的logic类 LCustomer lCustomer = (LCustomer)GlobalObjectProvider.getLogicService(CommonConst.LOGIC_KEY_CUSTOMER);

//添加对应的记录

lCustomer.modifyCustomer( customer );

//然后重新检索,并将页面迁移到一览页面

Vector vCustomers = lCustomer.getAllCustomer();

outputData.put( \, CommonConst.VIEWID_CUSTOMER_LIST); //往值域中设置当前位置信息

mySession.setAttribute(\, vCustomers ); outputData.put( \, new Integer(0) ); return; } }

22

(3)客户资料删除

public class ACustomerDelete {

//到首页

public void doFirst( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首页的index一定为0 outputData.put( \, CommonConst.VIEWID_CUSTOMER_DELETE); //往值域中设置当前位置信息

outputData.put( \, new Integer(0) ); return; }

23

//到末页

public void doLast( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得全部客户信息,并计算出最后一页的位置 Vector allCustomers = (Vector)mySession.getAttribute(\); int iMax = allCustomers.size();

int iMaxPage = (int)Math.ceil((double)iMax/20); int iIndex = (iMaxPage-1)*20;

//首页的index一定为0 outputData.put( \, CommonConst.VIEWID_CUSTOMER_DELETE); //往值域中设置当前位置信息

outputData.put( \, new Integer(iIndex) ); return; }

//到前页

public void doPrev( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得当前页

String sCurPage = (String)inputData.get(\); int iCurPage = (new Integer(sCurPage)).intValue(); int iIndex = (iCurPage-2)*20; outputData.put( \, CommonConst.VIEWID_CUSTOMER_DELETE); //往值域中设置当前位置信息

outputData.put( \, new Integer(iIndex) ); return; }

//到次页

public void doNext( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

24

//首先获得当前页

String sCurPage = (String)inputData.get(\); int iCurPage = (new Integer(sCurPage)).intValue(); int iIndex = iCurPage*20; outputData.put( \, CommonConst.VIEWID_CUSTOMER_DELETE); //往值域中设置当前位置信息

outputData.put( \, new Integer(iIndex) ); return; }

//到首页

public void doSpec( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得指定页码

String sSpecPage = (String)inputData.get(\); //获得全部客户信息,并计算出最后一页的位置 Vector allCustomers = (Vector)mySession.getAttribute(\); int iMax = allCustomers.size();

int iMaxPage = (int)Math.ceil((double)iMax/20); int iSpec = (new Integer(sSpecPage)).intValue(); //如果指定页大于全部页码,则跳转到第一页 if ( iSpec > iMaxPage ) {

iSpec = 1; }

//指定页

outputData.put( \, CommonConst.VIEWID_CUSTOMER_DELETE); //往值域中设置当前位置信息

outputData.put( \, new Integer((iSpec-1)*20) ); return; }

//修改某条记录

public void doDelete( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception

25

{

//首先获得要修改的客户ID String sCustomerId = (String)inputData.get(\);

//获得对应的客户的详细信息,然后迁移到客户详细信息修改页面 //调用对应的logic类 LCustomer lCustomer = (LCustomer)GlobalObjectProvider.getLogicService(CommonConst.LOGIC_KEY_CUSTOMER);

//删除对应的记录

lCustomer.deleteCustomerById( sCustomerId );

//然后重新检索,并定位到第一页

Vector vCustomers = lCustomer.getAllCustomer();

//由于需要在页面迁移中使用题库,所以放到session中

mySession.setAttribute( \, vCustomers );

//然后迁移到指定页面 outputData.put( \, CommonConst.VIEWID_CUSTOMER_DELETE); //往值域中设置当前位置信息

outputData.put( \, new Integer(0) ); return; } }

6、客户来电信息模块

快速反应页面的设计代码:

public class AQuickCondition {

//追加一个客户

public void doSearch( Hashtable inputData,

26

Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得要查找的相关资料 String sCustomerId = (String)inputData.get(\); String sRealname = (String)inputData.get(\); String sSex = (String)inputData.get(\); if ( sSex == null ) {

sSex = \; }

String sPhone = (String)inputData.get(\);

String sStartDate = (String)inputData.get(\); String sIncomeDate = (String)inputData.get(\); String sFeedbackDate = (String)inputData.get(\);

//调用对应的logic类 LCustomer lCustomer = (LCustomer)GlobalObjectProvider.getLogicService(CommonConst.LOGIC_KEY_CUSTOMER);

//然后检索,并将页面迁移到一览页面

Vector vCustomers = lCustomer.getCustomers( sCustomerId, sRealname, sSex, sPhone,

sStartDate, sIncomeDate, sFeedbackDate); //检索出来了数据

if ( vCustomers.size() > 0 ) {

outputData.put( \, CommonConst.VIEWID_QUICK_LIST); //往值域中设置当前位置信息

mySession.setAttribute(\, vCustomers ); outputData.put( \, new Integer(0) ); } else {

//重新显示条件录入页面

outputData.put( \, sCustomerId );

27

outputData.put( \, sRealname ); outputData.put( \, sSex ); outputData.put( \, sPhone ); outputData.put( \, sStartDate ); outputData.put( \, sIncomeDate ); outputData.put( \, sFeedbackDate );

outputData.put( \, CommonConst.VIEWID_QUICK_CONDITION); outputData.put( \, \检索结果为0件,请重新指定查询条件!\ ); }

return; } }

7、客户回访信息模块

public class AFeedbackCondition {

//查找

28

public void doSearch( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得要查找的相关资料 String sCustomerId = (String)inputData.get(\); String sCallFrom = (String)inputData.get(\); String sFromTime = (String)inputData.get(\); String sToTime = (String)inputData.get(\);

//调用对应的logic类 LFeedback lFeedback = (LFeedback)GlobalObjectProvider.getLogicService(CommonConst.LOGIC_KEY_FEEDBACK);

//然后检索,并将页面迁移到一览页面

Vector vFeedbacks = lFeedback.getFeedbacks( sCustomerId, sCallFrom, sFromTime, sToTime );

outputData.put( \, CommonConst.VIEWID_FEEDBACK_LIST); //往值域中设置当前位置信息

mySession.setAttribute(\, vFeedbacks ); outputData.put( \, new Integer(0) ); return; } }

29

8、客户重要信息提示模块

public class ARemind {

//到首页

public void doFirst( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首页的index一定为0 outputData.put( \, CommonConst.VIEWID_INFOR_REMIND); //往值域中设置当前位置信息

outputData.put( \, new Integer(0) );

30

return; }

//到末页

public void doLast( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得全部客户信息,并计算出最后一页的位置 Vector allCustomers = (Vector)mySession.getAttribute(\); int iMax = allCustomers.size();

int iMaxPage = (int)Math.ceil((double)iMax/20); int iIndex = (iMaxPage-1)*20;

//首页的index一定为0 outputData.put( \, CommonConst.VIEWID_INFOR_REMIND); //往值域中设置当前位置信息

outputData.put( \, new Integer(iIndex) ); return; }

//到前页

public void doPrev( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得当前页

String sCurPage = (String)inputData.get(\); int iCurPage = (new Integer(sCurPage)).intValue(); int iIndex = (iCurPage-2)*20; outputData.put( \, CommonConst.VIEWID_INFOR_REMIND); //往值域中设置当前位置信息

outputData.put( \, new Integer(iIndex) ); return; }

//到次页

public void doNext( Hashtable inputData, Hashtable outputData,

31

HttpSession mySession ) throws Exception {

//首先获得当前页

String sCurPage = (String)inputData.get(\); int iCurPage = (new Integer(sCurPage)).intValue(); int iIndex = iCurPage*20; outputData.put( \, CommonConst.VIEWID_INFOR_REMIND); //往值域中设置当前位置信息

outputData.put( \, new Integer(iIndex) ); return; }

//到首页

public void doSpec( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得指定页码

String sSpecPage = (String)inputData.get(\); //获得全部客户信息,并计算出最后一页的位置 Vector allCustomers = (Vector)mySession.getAttribute(\); int iMax = allCustomers.size();

int iMaxPage = (int)Math.ceil((double)iMax/20); int iSpec = (new Integer(sSpecPage)).intValue(); //如果指定页大于全部页码,则跳转到第一页 if ( iSpec > iMaxPage ) {

iSpec = 1; }

//指定页

outputData.put( \, CommonConst.VIEWID_INFOR_REMIND); //往值域中设置当前位置信息

outputData.put( \, new Integer((iSpec-1)*20) ); return; }

}

32

六、对本系统开发的思考总结

MVC模块划分、内容结构如何组织的方法,对一个Web程序设

计的影响是很大的,有效的规划可以为Web程序设计增加美感。其它的模块则有一定的联系性。

但是所有的模板其并非是层级关系——即一层一层的点下去,他们可以通过导航栏上的链接转到其它WEB程序设计上,由此可形成一个具有Web程序设计的模式,因此这些模块之间可以实现无顺序关系,却仍能感受到该Web程序设计是一个很条理。

美工方面做得还是差了些,以后会多下一番功夫。

七、对软件开发方法的体会

我想这次项目的完成对我们有很大的帮助,不仅在JAVA语言的运用上有了提高,对于数据库语言及操作也有了比较全面深刻的了解,比如如何创建一个表,插入相应的字段,给字段添加相关的属性,以及对表进行相关的搜索。在服务器中的.xml文件配置方面也了解到了相应标签的含义以及如何配置,并上传到服务器上。在此次项目中,对有关制作WEB项目的软件比如Tomcat、MyEclipse等软件的运用上也有了小幅的提高。综合一上,这次web项目的制作对我在综合运用方面有了很大的帮助提高。

在本次项目的编写修改过程中,遇到最大的困难是在主题部分中

33

发表汉字。一开始我们的项目中,只能发表和修改数字和英文,一旦出现汉字,就会显示出乱码或者报错,根据实际情况我们在DAO中加入了汉字转码语句,又将jsp页面中的编码形式全部改成utf-8的编码格式,但是发表或修改后的页面并没有像预期那样出现了中文,而且给我们报出了错误,经研究发现已经向后台数据库中插入了中文,但是在页面中无法显示,后对页面相应的语句进行微调后页面终于出现了中文。此外,在本次项目的编写中,我学会了对系统报出的404错误和500错误的问题出现的地方进行修改。

八、自主创新声明

本系统源于《Java Web

数据库系统应用开发与实例》书中的第八章内容,

在熟练掌握了书上内容的基础上,加入了自己的创新与理解,对于美工方面及css样式上做了改进,用户体验和交互性更好。

九、致谢

在这里我非常感谢我们的指导老师-贺秉庚,他对本系统的开发作

了悉心的讲解指导,帮助解决了多个难点,本系统才得以及时完成。不管是贺老师深厚的理论知识或是严谨的工作态度都让我受益匪浅。同时也很感谢我们同学的帮助,才得以成功完成此次课程设计。在整个课程设计过程中,我们互相帮助,互相学习,使大家都得到了不少的收获,也使我们全体成员都在课程设计中获得了整体的提高。 参考文献:

34

[1] 沈应逵. Java Web数据库系统应用开发与实例.北京:人民邮电出版社,2009

35

本文来源:https://www.bwwdw.com/article/7jqw.html

Top