»ùÓÚspringmvcµÄ¹ºÎïϵͳÂÛÎÄ20140508

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£©

»ùÓÚSpringMvcµÄ¹ºÎïƽ̨µÄÉè¼ÆÓëʵÏÖ

ר Òµ£ºÈí¼þ¹¤³Ì ѧ ºÅ£º201010414511

ѧ Éú£ºÈÎ Óî Í© Ö¸µ¼½Ìʦ£ºÀîÁ¢

ÕªÒª£ºËæ×ÅÐÅÏ¢»¯Ê±´úµÄÅ·¢Õ¹£¬ÍøÉϹºÎïƽ̨×÷Ϊµç×ÓÉÌÎñµÄÒ»ÖÖÐÎʽ£¬ÕýÔÚ¸ßËٵķ¢Õ¹¡£µ±½ñÉç»áÒѾ­Ô½À´Ô½¶àµÄÈË¿ªÊ¼½ÓÊܲ¢ÀÖÒâÓÚÍøÉϹºÎÍøÂ繺ÎïÕýÊÊÓ¦Á˵±½ñÉç»á¿ì½Ú×àµØÉú»î£¬Ê¹¹Ë¿Í×ã²»³ö»§±ã¿ÉÒÔ·½±ã¿ì½ÝÇáËɵØÑ¡¹º×Ô¼ºÏ²»¶µÄÉÌÆ·¡£

±¾ÎÄÉè¼Æ²¢¿ª·¢ÁËÒ»¸öÍøÉϹºÎïÉ̳¡£¬¸Ã¹ºÎïƽ̨ÒÔÆ·ÅÆΪÖÐÐĽøÐйÜÀí£¬ÏµÍ³Æ½Ì¨¿ÉÒÔÒÔ¼ÓÃ˵ķ½Ê½Ìṩ¸÷Æ·ÅƵÄÍøÂçÏúÊÛÇþµÀ£¬²¢Í¨¹ý¸Ãϵͳ¶ÔÆ·ÅÆ¡¢ÉÌÆ·µÈµÄ¹ÜÀí¡£ÎÄÖнéÉÜÁËʵÏÖ³ÌÐòµÄÏà¹Ø¼¼ÊõÓ뿪·¢¹¤×÷»·¾³£¬Ïêϸ²ûÊöÁËÕû¸öϵͳµÄÉè¼ÆºÍ¼Ü¹¹¡¢ÏµÍ³µÄÕûÀíÁ÷³ÌÒÔ¼°¸÷¸öÄ£¿éµÄ¹¦Äܺ͹Øϵ¡£±¾Éè¼ÆʹÓÃMyEclipse¿ª·¢»·¾³½áºÏMysql¡¢Tomcat£¬ÊµÏÖÁ˶ԹÜÀí¡¢Æ·ÅÆ¡¢ÀàÐÍ¡¢ÉÌÆ·¡¢¶©µ¥µÈµÄ¹ÜÀí£¬×îºóʵÏÖÁËÒ»¸öÎȶ¨µÄ¡¢½¡×³µÈ¹ºÎïƽ̨¡£ ¹Ø¼ü´Ê£º¹ºÎƽ̨£»Æ·ÅÆ£»ÉÌÆ·£»MyEclipse

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£©

The Design and Implementation of shopping platform

based on SpringMvc

Specialty: Software Engineering Student Number: 201010414511

Student: Ren Yutong Supervisor: Li li

Abstract: With the rapid development of the information age, online shopping as a form of e-commerce platform, is a high-speed development. Today's society more and more people begin to accept and be happy online shopping.Online shopping is adapted to the fast pace of life in today's society, so that customers can enjoy the convenience quickly and easily buy their favorite products.

This paper article is designed and developed an online shopping mall.The shopping platform to brand-centric management system platform can provide a way to join the brand's network of sales channels, and through the system management of the brand, produc and so on.This paper describes the realization of the program of technical and development work environment, elaborated on the relationship between functionality and overall system design and architecture, finishing systems and processes of each module. This design uses MyEclipse as a development environment, combined with the Mysql database, Tomcat server to achieve the management of brand, type, commodity, orders and so on.Finally achieve a stable, robust and other shopping platforms.

Key words: Shopping;Platform;Brand;MyEclipse

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© Ä¿ ¼

Ð÷ ÂÛ ........................................................................... 2 1 ÐèÇó·ÖÎö ...................................................................... 4 1.1 ¹¦ÄÜÐèÇó·ÖÎö .............................................................. 4 1.1.1 ÉÌÆ·ä¯ÀÀ .............................................................. 4 1.1.2 ÉÌÆ·¹ºÂò .............................................................. 4 1.1.3 µÇ¼ע²á .............................................................. 4 1.1.4 ¸öÈËÖÐÐÄ .............................................................. 5 1.1.5 ºǫ́¹ÜÀí .............................................................. 5 1.2 ¿ÉÐÐÐÔ·ÖÎö ................................................................ 5 1.2.1 ¾­¼Ã¿ÉÐÐÐÔ ............................................................ 5 1.2.2 ¼¼Êõ¿ÉÐÐÐÔ ............................................................ 5 1.2.3 ²Ù×÷¿ÉÐÐÐÔ·ÖÎö ........................................................ 6 1.2.4·¨ÂÉ¿ÉÐÐÐÔ ............................................................ 6 2 Ïà¹Ø¼¼Êõ½éÉÜ .................................................................. 7 2.1 JAVAÓïÑÔ½éÉÜ .............................................................. 7 2.2 SPRING½éÉÜ ................................................................ 7 2.3 SPRINGMVC½éÉÜ .............................................................. 7 2.4 HIBERNATE½éÉÜ .............................................................. 7 2.5 JAVASCRIPT½éÉÜ ............................................................. 8 2.6 JQUERY½éÉÜ ................................................................ 8 2.7 FREEMARKER½éÉÜ ............................................................. 9 2.8 ¿ª·¢Æ½Ì¨Ó빤¾ß½éÉÜ ........................................................ 9 2.8.1 MyEclipse¹¤¾ß½éÉÜ .................................................... 9 2.8.2 MysqlÊý¾Ý¿â½éÉÜ ...................................................... 9 2.8.3 ·þÎñÆ÷Tomcat½éÉÜ ..................................................... 9 3 Êý¾Ý¿â·ÖÎöÓëÉè¼Æ ............................................................. 10 3.1 Êý¾Ý¿âÉè¼ÆÔ­Ôò ........................................................... 10 3.2 Êý¾Ý¿â½á¹¹Éè¼Æ ........................................................... 10 3.3 ER¹Øϵͼ ................................................................ 14 4 ϵͳ¸ÅÒªÉè¼Æ ................................................................. 15 4.1 ϵͳ¹¦ÄÜÄ£¿é½á¹¹Í¼·ÖÎö ................................................... 15

I

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© 4.2 ϵͳ¹¦ÄÜÁ÷³Ìͼ ........................................................... 16 5.1 ¹«¹²Ä£¿éÉè¼ÆÓëʵÏÖ ....................................................... 17 5.1.1 ³ÌÐòĿ¼½á¹¹ ......................................................... 17 5.1.2 ϵͳÕûÌå¼Ü¹¹ ......................................................... 17 5.1.3 baseDao½éÉÜ ......................................................... 18 5.1.4 ·ÖÒ³bean½éÉÜ ........................................................ 19 5.2ϵͳģ¿éʵÏÖ ............................................................. 19 5.2.1 ÉÌƷչʾºÍ¹ºÂòÄ£¿é ................................................... 20 5.2.2 ¸öÈËÖÐÐÄÄ£¿é ......................................................... 24 5.2.3 ×¢²áµÇ¼ģ¿é ......................................................... 24 5.2.4 ϵͳ¹ÜÀíÔ±ºǫ́¹ÜÀíÄ£¿é ............................................... 26 5.2.5 Æ·ÅƹÜÀíÔ±¹ÜÀíÄÚÈÝÄ£¿é ............................................... 29 6 ÖØÄѵã·ÖÎö¼°½â¾ö·½°¸ ......................................................... 32 6.1 HIBERNATETEMPLATEµÄÓ¦Óà .................................................... 32 6.2 FREEMARKERµÄÓ¦Óà .......................................................... 33 6.3 Ê÷Ðνṹ²å¼þJQUERY ZTREE .................................................. 35 6.4 ÎļþÉÏ´«²å¼þUPLOADFLY ..................................................... 37 6.5 AJAX·ÖÒ³ ................................................................. 37 7 ϵͳ²âÊÔ ..................................................................... 39 7.1 ¹¦ÄܲâÊÔ ................................................................. 39 7.2 ÐÔÄܲâÊÔ ................................................................. 39 8 ϵͳ²¿Êð ..................................................................... 40 ½á ÂÛ .......................................................................... 41 ²Î¿¼ÎÄÏ× ....................................................................... 42 Ö л .......................................................................... 43

II

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© Ð÷ ÂÛ

Ñо¿µÄÄ¿µÄ

Ëæ×ÅÉç»áÒÔ¼°ÐÅÏ¢¼¼ÊõµÄ·¢Õ¹£¬Èç½ñµÄ»¥ÁªÍøÒѾ­ÉîÈëµ½ÈËÃÇÉú»îµÄ·½·½ÃæÃ棬ÍøÉϹºÎïÒ²³ÉΪһÖÖÄêÇáÈËÉõÖÁÊÇÀÏÈ˺ÍСº¢µÄÒ»ÖÖ¹ºÎ﷽ʽ£¬ÔËÓªÉÌÒÔ¼°µê¼ÒµÄŬÁ¦£¬ÍøÉϹºÎïÒѾ­±äµÃ¼òµ¥¡¢·½±ã¡¢¿ì½Ý£¬Ô½À´Ô½¶àµÄÈËϲ»¶ÉÏÕâÑùÒ»ÖÖ¹ºÎ﷽ʽ¡£ÔÚ¹úÄÚÌÔ±¦¡¢Ììè¡¢¾©¶«Õ⼸´óÍøÉÏÉ̳ǺÏÁ¦´Ù½øÁËÍøÉϹºÎïÔÚÖйúµÄ·¢Õ¹¡£

¹ØÓÚ±¾¿ÎÌâµÄ¹ºÎïƽ̨µÄÉè¼ÆÊÇΪÁËÄܹ»¸úÉϹã´óÈËÃñÍø¹ºµÄÒ»¸öÐèÇó£¬ÏµÍ³»á¾¡Á¿Éè¼ÆµÃСÇÉ£¬×÷Ϊһ¸öƽ̨ȥÊÊÓ¦²»Í¬ÄÚÐ͵ÄÉÌÆ·£¬ÔÚÒ»¶¨³Ì¶ÈÉÏÔö¼Ó¹º¹ºÎïƽ̨µÄÉÌÆ·ÐÅÏ¢´¦ÀíÁ¿£¬Ï¸»¯·ÖÀ࣬ÕâÑùÀ´¸øÓû§Ìṩ׼ȷµÄÉÌÆ·ÐÅÏ¢£¬±ãÓÚÓû§µÄ²éѯµÈ¡£¸Ã¹ºÎïƽ̨ҲӵÓÐһЩÆÕ±éµÄ¹¦ÄÜ°üÀ¨ÉÌÆ·¹ÜÀí¡¢¶©µ¥¹ÜÀíµÈµÈ£¬Í¬Ê±ËùÓÐÈ˶¼Äܹ»ä¯ÀÀËùÓÐÉÌÆ·£¬µ±ÐèÒª¹ºÂòÉÌÆ·µÄʱºòÔòÐèÒªµÇ¼¡£Í¬Ê±¸ÃϵͳվÔÚÒ»¸öƽ̨µÄ½Ç¶È£¬ÒÔÆ·ÅÆΪºËÐĽøÐйÜÀí£¬Í¨¹ýϵͳÒÔÆ·ÅƼÓÃ˵ÄÐÎʽ²úÉú¹ÜÀíÔ±£¬Ò»¸öÆ·ÅƶÔÓ¦ÓÚÒ»¸ö¹ÜÀíÕË»§£¬ÏµÍ³Í¨¹ýϵͳ¹ÜÀíÔ±¶ÔÆ·ÅƹÜÀíÔ±½øÐйÜÀí£¬ÕâÑù¸Ãϵͳ¾ÍͬʱվÔÚÉ̼ÒÒÔ¼°Ïû·ÑÕßË«·½£¬ÎªË«·½Ìṩ·þÎñ¡£

Ñо¿µÄÒâ˼

×ÜÌå¶øÑÔ¸ÃÉè¼Æ½«ÊµÏÖÒ»¸öСÇÉÁé»îµÄ¹ºÎïƽ̨£¬¸Ãƽ̨Äܹ»ÈÃÓû§Í¨¹ý¸ü¼Ó¼ò½àµÄ·½Ê½Á˽⵽¾ßÌåµÄÉÌÆ·£¬´Ó¶øʵÏÖÒ»¸öÄܹ»ÊÊÓ¦´óÖÚ»¯µÄ¹ºÎïƽ̨£¬Ìá¸ßÍøÕ¾ÓëÓû§µÄ½»»¥£¬×öµ½¸ü¼ÓµÄÈËÐÔ»¯¡£

¹úÄÚÏÖ×´

ÔÚÎÒ¹ú£¬ÍøÉϹºÎïµÄÀíÄîºóÆðÓë¹úÍ⣬µ«ÊÇ·¢Õ¹ËÙ¶ÈÒ²ÊǾªÈ˵ģ¬ÍøÉϹºÎïϵͳÒѾ­µÃµ½Á˺ܴóµÄ·¢Õ¹£¬ÔÚÌÔ±¦¡¢ÌìèÒÔ¼°Ò»Ð©ÓÐÃûµÄÍŹºÍøÒÔ¼°·µÀûÍøµÄ´ø¶¯Ï£¬Õû¸öÐÐÒµÒѾ­³ÉÊì¡£¸÷ÖÖϵͳ¶¼ÔÚÒÔ¿Í»§ÎªÖÐÐÄ£¬¸ø¿Í»§ÌṩºÃµÄ·þÎñ£¬ÔÚϵͳ¹¦ÄÜÉÏÒ²ÊÇÈ¡µÃÁ˷dz£´óµÄ½ø¶È£¬ÕâÁ½ÌìÌÔ±¦Í˳öµÄ˫ʮһ»î¶¯ÖУ¬Äܹ»µ¥ÈÕ´´ÏÂ300ÒڵĽ»Ò׶ÕâÌåÏÖÁ˹úÄÚµÄÖ÷ÒªµÄ´óÉ̳¡ÓÐÄÜÁ¦´¦Àí¸ß²¢·¢µÈÌØÊâÇé¿ö£¬¹úÄÚÏÖÓÐϵͳÊǷdz£½¡×³¡¢Îȶ¨¡¢¿É¿¿µÄ¡£

Ëæ×ÅÈËÃñÉú»îˮƽµÄ¸ÄÉÆÒÔ¼°ÐÅÏ¢¼¼Êõ¡¢µç×ÓÉÌÎñµÈµÄ¿ìËÙ·¢Õ¹£¬Ä¿Ç°¶øÑÔ¾ø´ó¶àÊýµÄÉ̼Ҷ¼ÒѾ­ÔÚÍøÉϽ¨ÆðÁËÔÚÏßÉ̵ê»òÕßÔÚÌÔ±¦¡¢Ììè¡¢¶«¾©É̳ÇÉÏÃæÉϼܣ¬ÏòÏû·ÑÕßչʾ³öÒ»ÖÖÐÂÓ±µÄ¹ºÎïÀíÄ²¢ÇÒ¾ø´ó¶àÊýÈËÒѾ­½áÊø²¢ÇÒϲ»¶ÕâÑùÒ»ÖÖ¹ºÎ﷽ʽ¡£

¹úÍâÏÖ×´

ÔÚÃÀ¡¢ÈÕµÈÐÅÏ¢»¯³Ì¶È½Ï¸ßµÄ¹ú¼ÒºÍµØÇø£¬ÍøÂçÉ̵귢չËÙ¶ÈѸÃÍ£¬ÃÀ¹úµÄÊÀ½ç¼¶³¬Ò»Á÷µÄÁãÊÛÉÌ£¬ÈçÎÖ¶ûÂê¡¢¿­ÂêÌØ¡¢¼ÒÍ¥²Ö´¢¡¢¿ÆÂÞ¸ñ¡¢J.CÅàÄáµÈ·×·×õÒÉíÓÚÍøÂç¾­É̵ÄÐÐÁС£µ÷²é±íÃ÷£ºÃÀ¹úµÄ¼ÒÍ¥¼ºÔ½À´Ô½Ï°¹ßÓÚÔÚ¼ÒÖдÓÍøÉϹºÎï¡£

2

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ·¢Õ¹Ç÷ÊÆ

ÍøÉϹºÎïÊÇÐÅϢʱ´úµÄ²úÎ»áËæ×ÅÐÅϢʱ´úµÄ·¢Õ¹¼ÌÐø·¢Õ¹£¬Ò²»áÓÐÔ½À´Ô½µÄµÄÈËÑ¡ÔñºÍϲ»¶ÕâÖÖ¹ºÎ﷽ʽ£¬ÔÚδÀ´ºÜÓпÉÄÜÍøÉϹºÎï³ÉΪÈËÃǹºÎïµÄÊ×Òª·½Ê½£¬¹ºÎïϵͳҲ»áÔ½·¢µÄÍêÉƺÍÈËÐÔ»¯¡£Ëæ×ÅÉç»áµÄ·¢Õ¹¶ÔÓÚƽ̨ÒÔ¼°Ë«Ó®µÈ˼ÏëÒ²Öð½¥ÔËÓÃÓÚ¸ÃÁìÓò£¬±ÈÈçһЩ·µÀûÍø¡¢ÕÛ¿ÛÍø¡¢ÍŹºÍøµÈµÈÒѾ­ÔÚÌåÏÖÕâ·½ÃæµÄ˼ÏëÁË£¬É̼ÒÔÚ×·ÇóÏúÁ¿µÄÇé¿öÏ¿ªÊ¼ÏòÏû·ÑÕßÈÃÀû¡£ÔÚδÀ´ÕâÖÖÓªÏúµÄ·½Ê½Ó¦¸Ã»áÔÚµçÉÌÖв»¶ÏµÄ·¢Õ¹ÏÂÈ¥£¬Öð½¥Ìá¸ßÏû·ÑÕßµÄÊÜÒæµÄ±ÈÀý¡£

3

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© 1 ÐèÇó·ÖÎö

ÔÚ±¾ÕÂÖн«Ïêϸ½éÉÜÕû¸öϵͳµÄÐèÇ󣬲¢ÇÒ¶ÔϵͳµÄ¿ÉÐÐÐÔ×÷³ö·ÖÎö£¬´Ó¶øÈöÁÕßÁ˽Ȿϵͳ¾ßÌåʵÏֵŦÄÜÒÔ¼°ÔÚÉè¼ÆºÍʵÏÖÉÏÊÇ·ñ¿ÉÐеȡ£

1.1 ¹¦ÄÜÐèÇó·ÖÎö

¸ÃϵͳΪһ¸ö¹ºÎïƽ̨£¬ÓµÓÐÆÕͨ¹ºÎïÍøÕ¾µÄ´ó¶àÊý»ù±¾¹¦ÄÜ£¬È磺ÉÌÆ·µÄä¯ÀÀ¡¢ÉÌÆ·¼ÓÈ빺Îï³µ¡¢Ï¶©µ¥¡¢Óû§µÇ¼¡¢¹ÜÀí¸öÈËÖÐÐÄÒÔ¼°¹ÜÀíÔ±ÔÚºǫ́¶ÔÆ·ÅÆ¡¢ÉÌÆ·¡¢ÉÌÆ·µÄÀàÐ͵ĹÜÀí¹¦Äܵȣ¬±¾½Ú»á¾¡Á¿°´ÕÕÈí¼þ¹¤³Ì[1]µÄ˼ÏëÀ´·ÖÎö±¾ÏµÍ³¡£

1.1.1 ÉÌÆ·ä¯ÀÀ

ËùÓõÄÈ˶¼Äܹ»ä¯ÀÀ±¾ÍøÕ¾ÉϵÄËùÓÐÉÌÆ·£¬ÉÌÆ·°´ÕÕÆ·ÅÆ¡¢ÉÌÆ·ÀàÐÍ¡¢¾«Æ·ÉÌÆ·¡¢ÌؼÛÉÌÆ·¡¢ÈÈÏúÉÌÆ·¡¢µ¥¸öÉÌÆ·µÈµÄ·½Ê½½«ÏµÍ³ÖеÄÉÌƷչʾ¸øÏû·ÑÕߣ¬²¢ÌṩËÑË÷¹¦ÄÜ£¬°´ÕÕÉÌÆ·µÄÃû³ÆµÈ½øÐÐËÑË÷¡£

1.1.2 ÉÌÆ·¹ºÂò

µ±Ïû·ÑÕßÑ¡ÔñºÃÉÌÆ·ÒԺ󣬿ÉÒÔ½«ÉÌÆ·¼ÓÈëµ½×Ô¼ºµÄ¹ºÎï³µÖУ¬È»ºóÔÚ¹ºÎï³µÖнøÐн»Ò×Ö§¸¶£¬Ò²¿ÉÒÔÔÚÑ¡ÔñºÃÉÌÆ·µÄͬʱ϶©µ¥£¬½øÐÐÖ§¸¶½»Ò×£¬µ±È»ËùÓеIJÙ×÷¶¼ÊÇÐèÒªÓû§µÇ¼µÄ¡£

1.1.3 µÇ¼ע²á

¶ÔÓÚϵͳµÇ¼ע²áÊÇÕë¶ÔÓÚϵͳµÄ½ÇÉ«¶øÑԵģ¬±¾ÏµÍ³ÕûÌåÉÏ·ÖΪÈýÀà½ÇÉ«¡£Æäһϵͳ¹ÜÀíÔ±£¬ÓµÓжÔϵͳµÄ¼òµ¥µÄ¹ÜÀíºÍ¹ÜÀíÔ±¹ÜÀíµÄ¹¦ÄÜ£¬ÏµÍ³¹ÜÀíÔ±ÓÐϵͳÄÚÖÃÉú³É¡£Æä¶þÊÇÆ·ÅƹÜÀíÔ±£¬Ò»¸öÆ·ÅƹÜÀíÓµÓÐÒ»¸öÆ·ÅƹÜÀíÔ±Õ˺ţ¬Í¨¹ý¸ÃÕ˺ŹÜÀí¸ÃÆ·ÅÆϵÄËùÓеÄ×ÊÔ´ºÍÐÅÏ¢£¬°üÀ¨¶Ô×Ô¼ºÐÅÏ¢µÄ¹ÜÀíºÍÆ·ÅÆÐÅÏ¢µÄ¹ÜÀíÒÔ¼°Æ·ÅÆÏÂÉÌÆ·ÀàÐ͵ĹÜÀí¡¢ÉÌÆ·ÐÅÏ¢¡¢¶©µ¥ÐÅÏ¢µÈµÄ¹ÜÀí¡£Æä¶þÊÇϵͳ»áÔ±£¬Ò²¾ÍÊÇҪͨ¹ý¸ÃÍøÕ¾¹ºÎïµÄ»áÔ±£¬»áÔ±µÇ¼¹ýºó¶Ô¸öÈËÖÐÐĽøÐйÜÀí£¬°üÀ¨×ÔÉíÐÅÏ¢¡¢µÇ¼ÃÜÂë¡¢Ö§¸¶ÃÜÂë¡¢¹ºÎï³µ¡¢¶©µ¥µÈµÄ¹ÜÀí¡£

¶ÔÓÚ×¢²áÔòÖ÷ÒªÕë¶ÔÓÚÆ·ÅƹÜÀíÔ±ºÍ»áÔ±µÄ×¢²á£¬Æ·ÅƹÜÀíÔ±×¢²áÐèÒªÁ¬Í¬Æ·ÅÆÐÅϢһͬע²á£¬×¢²á³É¹¦¹ýºóµÈ´ýϵͳ¹ÜÀíÔ±µÄÉóºË£¬ÉóºËͨ¹ý¹ýºó¾Í¿ÉÒÔ¶Ô×Ô¼ºÆ·ÅƵĸ÷ÏîÐÅÏ¢½øÐйÜÀí¡£¶ÔÓÚ»áÔ±µÄ×¢²áÐèÒªÓû§Ãû¡¢ÃÜÂë¡¢ÓÊÏäµØÖ·µÈ£¬¶ÔÓÚ»áÔ±µÄ×¢²áÔò²»ÐèҪϵͳ¹ÜÀíÔ±µÄÉóºË¡£×¢²á³É¹¦¹ýºóµÇ¼ϵͳ½øÈëµ½¸öÈËÖÐÐÄÄܹ»ÍêÉÆ×Ô¼ºµÄ¸÷ÏîÐÅÏ¢ºÍÆäËüµÄһЩÐÅÏ¢µÄ¹ÜÀí¡£

4

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© 1.1.4 ¸öÈËÖÐÐÄ

»áÔ±¹ºÂòÉÌƷʱÐèÒªµÇ¼²ÅÄܹ»¹ºÂòÉÌÆ·£¬»áÔ±µÇ¼¹ýºóÄܹ»½øÈëµ½¸öÈËÖÐÐÄ£¬ÔÚ¸öÈËÖÐÐÄÖлáÔ±Äܹ»¹ÜÀí×Ô¼ºµÄ»ù±¾ÐÅÏ¢£¬°üÀ¨£ºÓû§Ãû¡¢ÓÊÏäµØÖ·¡¢µç»°ºÅÂë¡¢ÊÕ»õµØÖ·µÈ£¬Í¬Ê±Äܹ»¹ÜÀí×Ô¼ºµÄµÇ¼ÃÜÂëºÍÖ§¸¶ÃÜÂ룬µ±¹ºÂòÉÌÆ·µÄʱºò»¹ÄܶÔ×Ô¼ºµÄ¹ºÎï³µºÍ×Ô¼ºµÄ¹ºÂò¼Ç¼½øÐв鿴ºÍ²Ù×÷¡£

1.1.5 ºǫ́¹ÜÀí

ϵͳ¹ÜÀíÔ±ºÍÆ·ÅƹÜÀíÔ±¶¼¿ÉÒÔ½øÈ뵽ϵͳºǫ́£¬¸ù¾Ý²»Í¬µÄ½ÇÉ«¹ÜÀí²»Í¬µÄÏϵͳ¹ÜÀíÔ±ÓµÓÐ×î¸ßȨÏÞ£¬µ«ÊDz¢²»ÊǹÜÀíËùÓеÄÄÚÈÝ£¬ÔÚ±¾ÏµÍ³ÏµÍ³¹ÜÀíÔ±×îÖ÷ÒªµÄ¹¦ÄÜÔòÊǶÔÆ·ÅƹÜÀíÔ±µÄ¹ÜÀí£¬Ã¿Ò»¸ö×¢²áµÄÆ·ÅƹÜÀíÔ±¶¼ÐèҪͨ¹ýϵͳ¹ÜÀíÔ±µÄÉóºË²ÅÄܹ»Ê¹Óá£Æ·ÅƹÜÀíÔ±Ïà¶Ôϵͳ¹ÜÀíÔ±¶øÑÔ¹ÜÀíµÄÄÚÈÝÒªÏà¶Ô¶àÐí¶à£¬µ«ÊÇÒ²¶¼ÊǹÜÀí±¾Æ·ÅƵÄÄÚÈÝ¡£Æ·ÅƹÜÀíÔ±µÄ¹ÜÀíÄÚÈÝ°üÀ¨×Ô¼º»ù±¾ÐÅÏ¢µÄ¹ÜÀí¡¢Æ·ÅÆÐÅÏ¢µÄ¹ÜÀí¡¢ÀàÐ͵ĹÜÀí¡¢ÉÌÆ·µÄ¹ÜÀí¡¢¶©µ¥µÄ¹ÜÀíµÈ¡£

1.2 ¿ÉÐÐÐÔ·ÖÎö

ÔÚϵͳµÄÉè¼ÆºÍ¿ª·¢Ö®Ç°¶¼»á¶ÔϵͳÓÐÒ»¸ö´óÌåµÄÈÏʶ²¢ÇÒͨ¹ý×ܹ²·ÖÎöÀ´È·¶¨ÏµÍ³ÊÇ·ñÖµµÃ¿ª·¢¡¢ÏµÍ³ÊÇ·ñÄܹ»ºÜºÃµÄ¿ª·¢³öÀ´ÒÔ¼°¿ª·¢³öÀ´¹ýºóµÄʵ¼ÊЧÒæµÈµÈ¡£±¾½Ú½«Í¨¹ý¾­¼Ã¿ÉÐÐÐÔ¡¢²Ù×÷¿ÉÐÐÐÔ¡¢¼¼Êõ¿ÉÐÐÐԵȷ½Ãæ¶ÔϵͳµÄ¿ÉÐÐÐÔ½øÐÐÏêϸµÄ·ÖÎö¡£

1.2.1 ¾­¼Ã¿ÉÐÐÐÔ

Éè¼ÆºÍ¿ª·¢¹ºÎïϵͳµÄÓ²¼þºÍÈí¼þÒÔ¼°·þÎñÆ÷ÒªÇ󶼲»¸ß£¬ÓµÓÐһ̨ÆÕͨµÄ¸öÈ˵çÄÔ»òÕßPC»ú¾ù¿É¡£ÒªÍ¨¹ýJavaÉè¼Æ¿ª·¢ÕâÌ×ϵͳÐèÒªÔÚ¸öÈ˵çÄÔÉÏÅäÖÃJavaµÄÔËÐл·¾³JdkºÍJre£¬Í¬Ê±ÅäÖ÷þÎñÆ÷Tomcat¡¢¿ª·¢¹¤¾ßMyEclipse¡¢Êý¾Ý¿âMysql£¬ÕâЩ¶¼ÊÇÃâ·ÑµÄ£¬ËùÒÔÔÚÕâ¸öµçÄÔÆÕ¼°Âʷdz£¸ßµÄÇé¿öÏ£¬ÕâÌ×ϵͳµÄ¿ª·¢¾­·Ñ¼¸ºõΪ0£¬ËùÒÔÔÚ¾­¼Ã·½ÃæÊÇ¿ÉÐеġ£

1.2.2 ¼¼Êõ¿ÉÐÐÐÔ

±¾ÏµÍ³µÄ¿ª·¢²ÉÓÃSpringºÍHibernate×÷ΪºËÐÄ£¬ÕâÁ½Ãż¼ÊõÊÇJavaEE×îÈÈÃÅÒ²ÊÇʹÓÃ×î¹ã·ºµÄÁ½ÖÖ¿ò¼Ü£¬ÔÚÍøÂçÉÏÓµÓдóÁ¿µÄ×ÊÁÏ¡¢×ÊÔ´£¬Ïà¶ÔÓ¦µÄÉçÇøÒ²ÊǷdz£µÄ»îÔ¾¡£ÁíÍâÕâÒ²ÊÇ×Ô¼ºËùÊìϤµÄ¿ò¼Ü£¬Æ½Ê±×Ô¼ºÔÚѧϰºÍ¹¤×÷ÖÐÓдóÁ¿µÄʹÓã¬ËùÒÔÔÚÍøÕ¾µÄºǫ́¿ª·¢·½ÃæÎÊÌâ²»´ó¡£¶ÔÓÚÍøÕ¾µÄÇ°¶Ë¶øÑÔ£¬×Ô¼º¶ÔÓÚJavascript¡¢Jquery¡¢Css¡¢Css3.0Ò²Óв»ÉÙµÄÁ˽⣬ÌرðÊǶÔÓÚJavascriptºÍJqueryÊǺÜÊìϤµÄ£¬ÓÐ×ã¹»µÄÄÜÁ¦À´´¦ÀíºÃÍøÕ¾µÄ²¼¾Ö¡¢ÍøվЧ¹ûµÄʵÏÖ¡¢ÍøÕ¾ÌØЧ¡¢Êý¾ÝÇëÇó´¦ÀíµÈ¡£

5

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ÁíÒ»·¢Ãæ¸ÃϵͳÕûÌåµÄÒµÎñÂß¼­ÓëÒ»°ãµÄ¹ºÎïϵͳµÄÒµÎñÂß¼­ÏàËÆ£¬ÒµÎñÂß¼­´¦ÀíÆðÀ´Ò²²»¸´ÔÓ£¬ËùÒÔÔÚÅäºÏHibernate¶ÔÊý¾ÝµÄ²Ù×÷É϶ÔÓÚSQLµÄÒªÇó¾Í¸ü¼ÓµÄµÍÁË£¬ËùÒÔÔÚÕâ·½ÃæÒ²ÊÇ¿ÉÐеġ£

×ÛÉÏËùÊö£¬ÔÚ¼¼Êõ·½ÃæÒ²ÊÇ¿ÉÐеġ£ 1.2.3 ²Ù×÷¿ÉÐÐÐÔ·ÖÎö

Õû¸öϵͳµÄÒµÎñÂß¼­ÀàËÆÓÚ´ó¶àÊýµÄ¹ºÎïÉ̳¡£¬·ûºÏÈËÃÇƽʱ¹ºÎïµÄÏ°¹ßºÍ²Ù×÷Ï°¹ß¡£ÕûÌåÒµÎñÂß¼­ÉÏÒÔÆ·ÅÆΪºËÐÄÕ¹¿ª£¬Æ·ÅÆÏÂÃæ°üº¬ÀàÐÍ£¬ÀàÐÍÏÂÃæ°üº¬ÉÌÆ·£¬ÕûÌåÁ÷³Ì·Ç³£ÇåÎú¡£ÁíÒ»·½Ã棬ϵͳÕûÌåµÄ·ç¸ñΪ¼ò½à·ç¸ñ£¬Óû§µÄ×¢²á¡¢ÒÔ¼°ÆäËüÐÅÏ¢µÄÌí¼ÓºÍÐ޸Ķ¼·Ç³£µÄ¼ò½àÒѲÙ×÷¡£×ÛÉÏËùÊö£¬±¾ÏµÍ³²Ù×÷ÉÏÊÇ¿ÉÐеġ£

1.2.4·¨ÂÉ¿ÉÐÐÐÔ

¸Ãϵͳ²»´¥¼°Èκεķ¨ÂÉ·¨¹æÎÊÌ⣬Ϊ´óÖÚÌṩ·þÎñ£¬²»Ëð»µÈκεĵÄÀûÒ棬ËùÒÔÔÚ·¨ÂÉÉÏÊÇ¿ÉÐеġ£

6

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© 2 Ïà¹Ø¼¼Êõ½éÉÜ

2.1 JavaÓïÑÔ½éÉÜ

JavaÊÇSun¹«Ë¾ÍƳöµÄÒ»ÖÖ±à³ÌÓïÑÔ¡£ËüÊÇÒ»ÖÖͨ¹ý½âÊÍ·½Ê½À´Ö´ÐеÄÓïÑÔ£¬Óï·¨¹æÔòºÍC++ÀàËÆ¡£Í¬Ê±£¬JavaÒ²ÊÇÒ»ÖÖ¿çƽ̨µÄ³ÌÐòÉè¼ÆÓïÑÔ¡£ÓÃJavaÓïÑÔ±àдµÄ³ÌÐò½Ð×ö¡°Applet¡±£¨Ð¡Ó¦ÓóÌÐò£©£¬ÓñàÒëÆ÷½«Ëü±àÒë³ÉÀàÎļþºó£¬½«Ëü´æÔÚWWWÒ³ÃæÖУ¬²¢ÔÚHTMLµµÉÏ×÷ºÃÏàÓ¦±ê¼Ç£¬Óû§¶ËֻҪװÉÏJavaµÄ¿Í»§Èí¼þ¾Í¿ÉÒÔÔÚÍøÉÏÖ±½ÓÔËÐС°Applet¡±¡£Java·Ç³£ÊʺÏÓÚÆóÒµÍøÂçºÍInternet»·¾³£¬ÏÖÔÚÒѳÉΪInternetÖÐ×îÊÜ»¶Ó­¡¢×îÓÐÓ°ÏìµÄ±à³ÌÓïÑÔÖ®Ò»¡£JavaÓÐÐí¶àÖµµÃ³ÆµÀµÄÓŵ㣬Èç¼òµ¥¡¢ÃæÏò¶ÔÏó¡¢·Ö²¼Ê½¡¢½âÊÍÐÔ¡¢¿É¿¿¡¢°²È«¡¢½á¹¹ÖÐÁ¢ÐÔ¡¢¿ÉÒÆÖ²ÐÔ¡¢¸ßÐÔÄÜ¡¢¶àÏ̡߳¢¶¯Ì¬ÐԵȡ£Java±÷ÆúÁËC++Öи÷ÖÖ±×´óÓÚÀûµÄ¹¦ÄܺÍÐí¶àºÜÉÙÓõ½µÄ¹¦ÄÜ¡£Java¿ÉÒÔÔËÐÐÓÚÈκÎ΢´¦ÀíÆ÷£¬ÓÃJava¿ª·¢µÄ³ÌÐò¿ÉÒÔÔÚÍøÂçÉÏ´«Ê䣬²¢ÔËÐÐÓÚÈκοͻ§»úÉÏ¡£

2.2 Spring½éÉÜ

SpringÊÇÒ»¸ö¿ªÔ´¿ò¼Ü£¬ËüÓÉRod Johnson´´½¨¡£ËüÊÇΪÁ˽â¾öÆóÒµÓ¦Óÿª·¢µÄ¸´ÔÓÐÔ¶ø´´½¨µÄ¡£SpringʹÓûù±¾µÄJavaBeanÀ´Íê³ÉÒÔÇ°Ö»¿ÉÄÜÓÉEJBÍê³ÉµÄÊÂÇ顣Ȼ¶ø£¬SpringµÄÓÃ;²»½öÏÞÓÚ·þÎñÆ÷¶ËµÄ¿ª·¢¡£´Ó¼òµ¥ÐÔ¡¢¿É²âÊÔÐÔºÍËÉñîºÏµÄ½Ç¶È¶øÑÔ£¬ÈκÎJavaÓ¦Óö¼¿ÉÒÔ´ÓSpringÖÐÊÜÒæ¡£

2.3 Springmvc½éÉÜ

Spring MVCÊôÓÚSpringFrameWorkµÄºóÐø²úÆ·£¬ÒѾ­ÈÚºÏÔÚSpring Web Flow[2]ÀïÃæ¡£Spring ¿ò¼ÜÌṩÁ˹¹½¨ Web Ó¦ÓóÌÐòµÄÈ«¹¦ÄÜ MVC Ä£¿é¡£Ê¹Óà Spring ¿É²åÈëµÄ MVC ¼Ü¹¹£¬¿ÉÒÔÑ¡ÔñÊÇʹÓÃÄÚÖÃµÄ Spring Web ¿ò¼Ü»¹¿ÉÒÔÊÇ Struts ÕâÑùµÄ Web ¿ò¼Ü¡£Í¨¹ý²ßÂÔ½Ó¿Ú£¬Spring ¿ò¼ÜÊǸ߶ȿÉÅäÖõģ¬¶øÇÒ°üº¬¶àÖÖÊÓͼ¼¼Êõ£¬ÀýÈç JavaServer Pages£¨JSP£©¼¼Êõ¡¢Velocity¡¢Tiles¡¢iText ºÍPOI¡£Spring MVC ¿ò¼Ü²¢²»ÖªµÀʹÓõÄÊÓͼ£¬ËùÒÔ²»»áÇ¿ÆÈÄúֻʹÓà JSP ¼¼Êõ¡£Spring MVC ·ÖÀëÁË¿ØÖÆÆ÷¡¢Ä£ÐͶÔÏó¡¢·ÖÅÉÆ÷ÒÔ¼°´¦Àí³ÌÐò¶ÔÏóµÄ½ÇÉ«£¬ÕâÖÖ·ÖÀëÈÃËüÃǸüÈÝÒ×½øÐж¨ÖÆ¡£

2.4 Hibernate½éÉÜ

HibernateÊÇÒ»¸ö¿ª·ÅÔ´´úÂëµÄ¶ÔÏó¹ØϵӳÉä¿ò¼Ü£¬Ëü¶ÔJDBC½øÐÐÁ˷dz£ÇáÁ¿¼¶µÄ¶ÔÏó·â×°£¬Ê¹µÃJava³ÌÐòÔ±¿ÉÒÔËæÐÄËùÓûµÄʹÓöÔÏó±à³Ì˼άÀ´²Ù×ÝÊý¾Ý¿â¡£ Hibernate¿ÉÒÔÓ¦ÓÃÔÚÈκÎʹÓÃJDBCµÄ³¡ºÏ£¬¼È¿ÉÒÔÔÚJavaµÄ¿Í»§¶Ë³ÌÐòʹÓã¬Ò²¿ÉÒÔÔÚServlet/JSPµÄWebÓ¦ÓÃÖÐʹÓã¬×î¾ß¸ïÃüÒâÒåµÄÊÇ£¬Hibernate¿ÉÒÔÔÚÓ¦ÓÃEJB[3]

7

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© µÄJ2EE¼Ü¹¹ÖÐÈ¡´úCMP£¬Íê³ÉÊý¾Ý³Ö¾Ã»¯µÄÖØÈΡ£

2.5 Javascript½éÉÜ

JavaScriptÊÇÒ»ÖÖ»ùÓÚ¶ÔÏóºÍʼþÇý¶¯²¢¾ßÓÐÏà¶Ô°²È«ÐԵĿͻ§¶Ë½Å±¾ÓïÑÔ¡£Í¬Ê±Ò²ÊÇÒ»Öֹ㷺ÓÃÓÚ¿Í»§¶ËWeb¿ª·¢µÄ½Å±¾ÓïÑÔ£¬³£ÓÃÀ´¸øHTML£¨±ê׼ͨÓñê¼ÇÓïÑÔµÄ×Ó¼¯£©ÍøÒ³Ìí¼Ó¶¯Ì¬¹¦ÄÜ£¬±ÈÈçÏìÓ¦Óû§µÄ¸÷ÖÖ²Ù×÷¡£Ëü×î³õÓÉÍø¾°¹«Ë¾£¨Netscape£©µÄBrendan EichÉè¼Æ£¬ÊÇÒ»ÖÖ¶¯Ì¬¡¢ÈõÀàÐÍ¡¢»ùÓÚÔ­Ð͵ÄÓïÑÔ£¬ÄÚÖÃÖ§³ÖÀà¡£JavaScriptÊÇSun¹«Ë¾(Òѱ»oracleÊÕ¹º£©µÄ×¢²áÉ̱ꡣEcma¹ú¼ÊÒÔJavaScriptΪ»ù´¡Öƶ¨ÁËECMAScript±ê×¼¡£JavaScriptÒ²¿ÉÒÔÓÃÓÚÆäËû³¡ºÏ£¬Èç·þÎñÆ÷¶Ë±à³Ì¡£ÍêÕûµÄJavaScriptʵÏÖ°üº¬Èý¸ö²¿·Ö£ºECMAScript£¬Îĵµ¶ÔÏóÄ£ÐÍ£¬×Ö½Ú˳Ðò¼ÇºÅ¡£

Netscape¹«Ë¾ÔÚ×î³õ½«Æä½Å±¾ÓïÑÔÃüÃûΪLiveScript¡£ÔÚNetscapeÔÚÓëSunºÏ×÷Ö®ºó½«Æä¸ÄÃûΪJavaScript¡£JavaScript×î³õÊÜJavaÆô·¢¶ø¿ªÊ¼Éè¼ÆµÄ£¬Ä¿µÄÖ®Ò»¾ÍÊÇ¡°¿´ÉÏÈ¥ÏñJava¡±[2]£¬Òò´ËÓï·¨ÉÏÓÐÀàËÆÖ®´¦£¬Ò»Ð©Ãû³ÆºÍÃüÃû¹æ·¶Ò²½è×ÔJava¡£µ«JavaScriptµÄÖ÷ÒªÉè¼ÆÔ­ÔòÔ´×ÔSelfºÍScheme[4]¡£JavaScriptÓëJavaÃû³ÆÉϵĽüËÆ£¬Êǵ±Ê±Íø¾°ÎªÁËÓªÏú[4]¿¼ÂÇÓëSun¹«Ë¾´ï³ÉЭÒéµÄ½á¹û¡£ÎªÁËÈ¡µÃ¼¼ÊõÓÅÊÆ£¬Î¢ÈíÍƳöÁËJScript½Å±¾ÓïÑÔ¡£Ecma¹ú¼Ê£¨Ç°ÉíΪŷÖÞ¼ÆËã»úÖÆÔìÉÌЭ»á£©´´½¨ÁËECMA-262±ê×¼£¨ECMAScript£©¡£ÏÖÁ½Õ߶¼ÊôÓÚECMAScriptµÄʵÏÖ¡£¾¡¹ÜJavaScript×÷Ϊ¸ø·Ç³ÌÐòÈËÔ±µÄ½Å±¾ÓïÑÔ£¬¶ø·ÇÊÇ×÷Ϊ¸ø³ÌÐòÈËÔ±µÄ±à³ÌÓïÑÔÀ´ÍƹãºÍÐû´«£¬µ«ÊÇJavaScript¾ßÓзdz£·á¸»µÄÌØÐÔ¡£

ECMAScript-262ÊÇJavaScript±ê×¼£¬»ùÓÚÍø¾°£¨Netscape£©¹«Ë¾Ìá³öJavaScriptÓïÑÔºÍ΢Èí¹«Ë¾Ìá³öµÄJScriptÓïÑÔ

ECMA¿ªÊ¼ÓÚ1996Ä꣬ÔÚ1997Äê7Ô£¬²ÉÄÉÁËÊ׸ö°æ±¾£¬1998Ä꣬¸Ã±ê×¼³ÉΪÁ˹ú¼ÊISO±ê×¼

2.6 Jquery½éÉÜ

JqueryÊǼÌprototypeÖ®ºóÓÖÒ»¸öÓÅÐãµÄJavascript¿ò¼Ü¡£ËüÊÇÇáÁ¿¼¶µÄjs¿â £¬Ëü¼æÈÝCSS3£¬»¹¼æÈݸ÷ÖÖä¯ÀÀÆ÷£¨IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+£©£¬jQuery2.0¼°ºóÐø°æ±¾½«²»ÔÙÖ§³ÖIE6/7/8ä¯ÀÀÆ÷¡£jQueryʹÓû§Äܸü·½±ãµØ´¦ÀíHTML£¨±ê׼ͨÓñê¼ÇÓïÑÔϵÄÒ»¸öÓ¦Óã©¡¢events¡¢ÊµÏÖ¶¯»­Ð§¹û£¬²¢ÇÒ·½±ãµØΪÍøÕ¾ÌṩAJAX½»»¥[5]¡£jQuery»¹ÓÐÒ»¸ö±È½Ï´óµÄÓÅÊÆÊÇ£¬ËüµÄÎĵµËµÃ÷ºÜÈ«£¬¶øÇÒ¸÷ÖÖÓ¦ÓÃҲ˵µÃºÜÏêϸ£¬Í¬Ê±»¹ÓÐÐí¶à³ÉÊìµÄ²å¼þ¿É¹©Ñ¡Ôñ¡£jQueryÄܹ»Ê¹Óû§µÄhtmlÒ³Ãæ±£³Ö´úÂëºÍhtmlÄÚÈÝ·ÖÀ룬Ҳ¾ÍÊÇ˵£¬²»ÓÃÔÙÔÚhtmlÀïÃæ²åÈëÒ»¶ÑjsÀ´µ÷ÓÃÃüÁîÁË£¬Ö»Ð趨Òåid

8

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ¼´¿É¡£

2.7 FreeMarker½éÉÜ

FreeMarkerÔÊÐíJava servlet±£³ÖͼÐÎÉè¼ÆͬӦÓóÌÐòÂß¼­µÄ·ÖÀ룬ÕâÊÇͨ¹ýÔÚÄ£°åÖÐÃÜ·âHTMLÍê³ÉµÄ¡£Ä£°åÓÃservletÌṩµÄÊý¾Ý¶¯Ì¬µØÉú³É HTML¡£Ä£°åÓïÑÔÊÇÇ¿´óµÄÖ±¹ÛµÄ£¬±àÒëÆ÷Ëٶȿ죬Êä³ö½Ó½ü¾²Ì¬HTMLÒ³ÃæµÄËٶȡ£ËäÈ»FreeMarker¾ßÓÐһЩ±à³ÌµÄÄÜÁ¦£¬µ«Í¨³£ÓÉJava³ÌÐò×¼±¸ÒªÏÔʾµÄÊý¾Ý£¬ÓÉFreeMarkerÉú³ÉÒ³Ã棬ͨ¹ýÄ£°åÏÔʾ׼±¸µÄÊý¾Ý¡£

FreeMarkerÓëÈÝÆ÷Î޹أ¬ÒòΪËü²¢²»ÖªµÀHTTP»òServlet£»FreeMarkerͬÑù¿ÉÒÔÓ¦ÓÃÓÚ·ÇWebÓ¦ÓóÌÐò»·¾³£¬FreeMarker¸üÊʺÏ×÷ΪModel2¿ò¼Ü£¨ÈçStruts£©µÄÊÓͼ×é¼þ£¬¿ÉÒÔÔÚÄ£°åÖÐʹÓÃJSP±ê¼Ç¿â£¬FreeMarkerÊÇÃâ·ÑµÄ¡£

2.8 ¿ª·¢Æ½Ì¨Ó빤¾ß½éÉÜ 2.8.1 MyEclipse¹¤¾ß½éÉÜ

MyEclipseÆóÒµ¼¶¹¤×÷ƽ̨£¨MyEclipse Enterprise Workbench £¬¼ò³ÆMyEclipse£©ÊǶÔEclipseIDEµÄÀ©Õ¹£¬ÀûÓÃËüÎÒÃÇ¿ÉÒÔÔÚÊý¾Ý¿âºÍJavaEEµÄ¿ª·¢¡¢·¢²¼ÒÔ¼°Ó¦ÓóÌÐò·þÎñÆ÷µÄÕûºÏ·½Ã漫´óµÄÌá¸ß¹¤×÷ЧÂÊ¡£ËüÊǹ¦ÄܷḻµÄJavaEE¼¯³É¿ª·¢»·¾³£¬°üÀ¨ÁËÍ걸µÄ±àÂë¡¢µ÷ÊÔ¡¢²âÊԺͷ¢²¼¹¦ÄÜ¡£

2.8.2 MysqlÊý¾Ý¿â½éÉÜ

MysqlÊÇ×îÁ÷ÐеĹØϵÐÍÊý¾Ý¿â¹ÜÀíϵͳ£¬ÔÚWEBÓ¦Ó÷½ÃæMysqlÊÇ×îºÃµÄRDBMS(Relational Database Management System£º¹ØϵÊý¾Ý¿â¹ÜÀíϵͳ)Ó¦ÓÃÈí¼þÖ®Ò»¡£MySQLÊÇÒ»ÖÖ¹ØÁªÊý¾Ý¿â¹ÜÀíϵͳ£¬¹ØÁªÊý¾Ý¿â½«Êý¾Ý±£´æÔÚ²»Í¬µÄ±íÖУ¬¶ø²»Êǽ«ËùÓÐÊý¾Ý·ÅÔÚÒ»¸ö´ó²Ö¿âÄÚ£¬ÕâÑù¾ÍÔö¼ÓÁËËٶȲ¢Ìá¸ßÁËÁé»îÐÔ¡£MySQLËùʹÓõÄSQLÓïÑÔÊÇÓÃÓÚ·ÃÎÊÊý¾Ý¿âµÄ×î³£Óñê×¼»¯ÓïÑÔ¡£MySQLÈí¼þ²ÉÓÃÁËË«ÊÚȨÕþ²ß£¬Ëü·ÖΪÉçÇø°æºÍÉÌÒµ°æ£¬ÓÉÓÚÆäÌå»ýС¡¢Ëٶȿ졢×ÜÌåÓµÓгɱ¾µÍ£¬ÓÈÆäÊÇ¿ª·ÅÔ´ÂëÕâÒ»Ìص㣬һ°ãÖÐСÐÍÍøÕ¾µÄ¿ª·¢¶¼Ñ¡ÔñMySQL×÷ΪÍøÕ¾Êý¾Ý¿â¡£

2.8.3 ·þÎñÆ÷Tomcat½éÉÜ

TomcatÊÇApache Èí¼þ»ù½ð»á£¨Apache Software Foundation£©µÄJakarta ÏîÄ¿ÖеÄÒ»¸öºËÐÄÏîÄ¿£¬ÓÉApache¡¢SunºÍÆäËûһЩ¹«Ë¾¼°¸öÈ˹²Í¬¿ª·¢¶ø³É¡£ÒòΪTomcat ¼¼ÊõÏȽø¡¢ÐÔÄÜÎȶ¨£¬¶øÇÒÃâ·Ñ£¬Òò¶øÉîÊÜJava °®ºÃÕßµÄϲ°®²¢µÃµ½Á˲¿·ÖÈí¼þ¿ª·¢É̵ÄÈÏ¿É£¬³ÉΪĿǰ±È½ÏÁ÷ÐеÄWeb Ó¦Ó÷þÎñÆ÷¡£Ä¿Ç°×îа汾ÊÇ8.0¡£

9

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© 3 Êý¾Ý¿â·ÖÎöÓëÉè¼Æ

±¾½Ú½«´ÓÊý¾Ý¿âÒÔ¼°Êý¾Ý±íµÄÉè¼ÆºÍʵÏÖ·½ÃæÏêϸµÄ½éÉÜÕû¸öϵͳµÄÊý¾Ý¿âµÄÉè¼ÆºÍʵÏÖ£¬²¢¶ÔÕû¸öϵͳµÄÒµÎñÂß¼­×ö³õ²½µÄ½éÉÜ£¬ÔÚÊý¾Ý¿âÉè¼Æ·½Ãæ»á¾¡Á¿µÄ¶à²ÎÓëһЩÔÚ¹ºÎïƽ̨[7]·½Ãæ·Ç³£ÓÅÐãµÄʵϰ¡£

3.1 Êý¾Ý¿âÉè¼ÆÔ­Ôò

£¨1£©¾¡¿ÉÄܵļõÉÙÊý¾ÝÈßÓàºÍÖظ´

ºÏÀíµÄÊý¾Ý¿â±íµÄÉè¼ÆÓ¦¸ÃÊÇÔÚÂú×ãÐèÇóµÄÇ°ÌáÏ£¬Ê¹Êý¾ÝµÄÖظ´Á¿×îС£¬Ó¦¾¡Á¿°´ÕÕ¹ØϵÊý¾Ý¿âϵͳÀíÂÛ·½·¨È¥Éè¼ÆÒ»¸öÊý¾Ý¿â£¬¼õÉÙÊý¾ÝµÄÈßÓà¡£

£¨2£©½á¹¹Éè¼ÆÓë²Ù×÷Éè¼ÆÏà½áºÏ

ÔÚÉè¼ÆÊý¾Ý¿â½á¹¹Ê±£¬ÓÐʱΪÁ˱à³ÌʵÏֵļò½ÝºÍ˼·µÄÇåÎú£¬ÍùÍù¹ÊÒâÔö¼ÓһЩÈßÓàÊý¾Ý¡£¿¼Âǵ½Ñ¡ÔñµÄ»úÆ÷Ðͺź͵µ´ÎµÈÒòËØ£¬Èç¹ûÔö¼ÓµÄÈßÓàÊý¾Ý²»»áÃ÷ÏÔÔö¼Ó´æ´¢¿Õ¼äºÍ½µµÍ´¦ÀíЧÂÊ£¬²¢ÇÒ¶Ô±à³ÌʵÏÖÓкܴó°ïÖú£¬ÍùÍù¿ÉÒÔ²ÉÓÃÕâÀà·½·¨[15]¡£

£¨3£©Êý¾Ý½á¹¹¾ßÓÐÏà¶ÔÎȶ¨ÐÔ

Êý¾Ý½á¹¹µÄÏà¶ÔÎȶ¨ÐÔ£¬¿ÉÒÔ×÷ΪС¢¾ÉÐÅϢϵͳµÄת»»ÒÀ¾Ý¡£ 3.2 Êý¾Ý¿â½á¹¹Éè¼Æ

±í3-1 ¹ÜÀíÔ±±í£¨admin£©

×Ö¶ÎÃû id name passWord header role isEnable

ÀàÐÍ Integer Varchar Varchar Varchar Int Int

ÊÇ·ñÊÇÖ÷Íâ¼ü ÊÇ ·ñ ·ñ

·ñ ·ñ ·ñ

Ë÷Òý ÊÇ ÊÇ ·ñ ·ñ ·ñ ·ñ

ÊÇ·ñΪ¿Õ Not-null Not-null Not-null

Not-null Not-null

×Ö¶ÎÃèÊö Ö÷¼üID µÇ¼Õ˺ŠµÇ¼ÃÜÂë ¹ÜÀíԱͷÏñ ϵͳ½ÇÉ« ÊÇ·ñ¿ÉÓÃ

²ÎÕÕ±í ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª

±í 3-1 ¹ÜÀíÔ±±í£¨admin£©¹ÜÀíÔ±±í£¬¸Ã±íÓÃÓÚ´æ·Å¹ÜÀíÔ±ÐÅÏ¢£¬ÆäÖÐidΪÖ÷¼ü£¬²»ÄÜΪ¿Õ²¢ÇÒ×Ô¶¯Ôö³¤×÷ΪË÷Òý£¬ÁíÍâ¹ÜÀíÔ±µÇ¼ÃÜÂë¾­¹ýMD5¼ÓÃÜ£¬±£Ö¤Óû§ÐÅÏ¢µÄ°²È«ÐÔ£¬headerΪÓû§µÄÍ·ÏñµÄ·¾¶¡£RoleΪϵͳ½ÇÉ«£¬±¾ÏµÍ³µÄºǫ́¹ÜÀíÓÐÁ½ÖÖ½ÇÉ«³¬¼¶¹ÜÀíÔ±ºÍÆÕͨ¹ÜÀíÔ±£¬roleΪ0±íʾ³¬¼¶¹ÜÀíÔ±£¬roleΪÆäËüÖµÔò±íʾƷÅƹÜÀíÔ±£¬role¶ÔÓÚ´æ·ÅµÄÊÇÆ·ÅƵÄID¡£isEnableÓÉÓÚ±íʾÓû§ÊÇ·ñ¿ÉÓã¬×¢²áµÄÆ·ÅƹÜÀíÔ±ÊDz»¿ÉÓã¬ÐèÒª¾­¹ý³¬¼¶¹ÜÀíÔ±µÄÉóºË£¬Í¨¹ý¸Ã×ֶγ¬¼¶¹ÜÀíÔ±Äܹ»¶ÔÆ·ÅƹÜÀíԱʵÏÖ¼Ùɾ³ý£¬ÊÇÆ·ÅƹÜÀíÔ±²»¿ÉÓá£

10

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ±í3-2 »áÔ±±í£¨member£©

×Ö¶ÎÃû Id name passWord payPassWord

email address phone createDate alertDate loadDate

ÀàÐÍ Integer Varchar Varchar Varchar Varchar Varchar Varchar DateTime DateTime Datetime

ÊÇ·ñÊÇÖ÷Íâ¼ü

ÊÇ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ

Ë÷Òý ÊÇ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ

ÊÇ·ñΪ¿Õ Not-null Not-null Not-null Not-null Not-null

Not-null Not-null Not-null

×Ö¶ÎÃèÊö Ö÷¼üID Óû§Ãû µÇ¼ÃÜÂë Ö§¸¶ÃÜÂë ÓÊÏäµØÖ· ÊÕ»õµØÖ· µç»°ºÅÂë ´´½¨Ê±¼ä ÐÞ¸Äʱ¼ä µÇ¼ʱ¼ä

²ÎÕÕ±í ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª

±í 3-2 »áÔ±±í£¨member£©ÓÃÓÚ´æ·Å»áÔ±µÄ»ù±¾ÐÅÏ¢£¬È磺Óû§Ãû¡¢ÃÜÂ루ͬÑù¾­¹ýmd5¼ÓÃÜ£©¡¢ÓÊÏäµØÖ·µÈ£¬ÆäÖÐidΪÖ÷¼ü£¬²»ÄÜΪ¿Õ²¢ÇÒ×Ô¶¯Ôö³¤×÷ΪË÷Òý¡£ÁíÍâ±¾±íÖдæ·ÅµÄµç»°ºÅÂë¡¢Óû§Ãû¡¢ÊÕ»õµØÖ·ÊÇ×÷Ϊ»áÔ±ÔÚ¹ºÎïµÄ»ù±¾ÐÅÏ¢£¬µ«¹ºÎïÊÇÓû§¿ÉÒÔÐ޸ģ¬×îºó¾ßÌåµÄÁªÏµ·½Ê½¡¢ÊÕ»õµØÖ·ÕâЩÓëÕâЩÊý¾ÝûÓÐÖ±½ÓµÄ¹Øϵ¡£

±í3-3 ÉÌÆ·ÀàÐÍ±í£¨goodsType£©

×Ö¶ÎÃû Id

Name ParentId level trademarkId isEnable

ÀàÐÍ Integer Varchar Integer Int Integer Int

ÊÇ·ñÊÇÖ÷Íâ¼ü

ÊÇ ·ñ ·ñ ·ñ ·ñ ·ñ

Ë÷Òý ÊÇ ·ñ ·ñ ·ñ ·ñ ·ñ

ÊÇ·ñΪ¿Õ Not-null Not-null Not-null Not-null Not-null Not-null

×Ö¶ÎÃèÊö Ö÷¼üID ÀàÐÍÃû³Æ ¸¸ÀàÐÍid ·ÖÀàµÈ¼¶ Æ·ÅÆid ÊÇ·ñ¿ÉÓÃ

²ÎÕÕ±í ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª

±í 3-3 ÉÌÆ·ÀàÐÍ±í£¨goodsType£©£¬ÓÃÓÚ´æ·ÅÉÌÆ·µÄÀàÐÍÐÅÏ¢£¬ÆäÖÐidΪÖ÷¼ü£¬²»ÄÜΪ¿Õ×Ô¶¯Ôö³¤£¬nameÓÃÓÚ´æ·ÅÀàÐ͵ÄÃû³Æ¡£¸Ã±íµÄÉè¼ÆÊÇ°´ÕÕ¶þ²æÊ÷Êý¾Ý½á¹¹À´Éè¼ÆµÄÒ»¸öÎÞÏÞ·ÖÀàµÄ±í½á¹¹£¬parentIdÓÃÓڼǼµ±Ç°ÀàÐ͵ĸ¸ÀàÐ͵ÄIDÖµ£¬levelÔò±íʾ·ÖÀàµÄµÈ¼¶¡£trademarkIdÍâ¼ü¹ØÁªÆ·ÅÆ±í£¬ÓÃÓڼǼµ±Ç°µÄÉÌÆ·ÀàËÆÊÇÊôÓÚÄÄÒ»¸öÆ·ÅƵģ¬±ãÓÚÒÔÆ·ÅÆΪºËÐĽøÐйÜÀí¡£

±í3-4 Æ·ÅÆÐÅÏ¢±í£¨trademark£©

×Ö¶ÎÃû Id Name Remarks icon flag isEnable

ÀàÐÍ Integer Varchar Varchar Varchar Int Int

ÊÇ·ñÊÇÖ÷Íâ¼ü

ÊÇ ·ñ ·ñ ·ñ ·ñ ·ñ

Ë÷Òý ÊÇ ÊÇ ·ñ ·ñ ·ñ ·ñ

ÊÇ·ñΪ¿Õ Not-null Not-null

Not-null Not-null

×Ö¶ÎÃèÊö Ö÷¼üID Æ·ÅÆÃû³Æ Æ·ÅƼò½é Æ·ÅÆͼ±í Æ·ÅÆÀàÐÍ ÊÇ·ñ¿ÉÓÃ

²ÎÕÕ±í ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª

±í3-4Æ·ÅÆÐÅÏ¢±í£¨trademark£©£¬ÓÃÓÚ´æ·ÅÆ·ÅƵĻù±¾ÐÅÏ¢£¬ÆäÖÐidΪÖ÷¼ü£¬²»ÄÜ

11

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© Ϊ¿Õ×Ô¶¯Ôö³¤£¬ÆäËüµÄ×ֶδ洢ƷÅƵÄÃû³Æ¡¢¼ò½é¡¢Í¼±ê¡¢ÀàÐ͵ȡ£ÆäÖÐflagΪƷÅƵÄÀàÐÍ£¬ÕâЩÀàÐÍΪϵͳÄÚÖõÄÀàÐÍ£¬ËùÓеÄÆ·ÅƵÄÀàÐͶ¼±ØÐë´ÓÕâЩÀàÐÍÖÐÑ¡È¡£¬Æ·ÅƵÄÀàÐÍÖ÷ÒªÓÐһϼ¸ÀࣺÈÕÓðٻõ¡¢·þÊΡ¢µçÆ÷/¼Òµç¡¢ÊýÂë¡¢¼Ò¾ß½¨²Ä¡¢Æû³µ/Åä¼þ¡¢ÊÎÆ·ÕâÆß´óÀ࣬»ù±¾ÉÏÕâÆß´óÀàÒ²Äܹ»ºÜºÃµÄ°üº¬¾ø´ó¶àÊýÆ·ÅƺÍÉÌÆ·¡£×îºóisEnableͬÑùÊÇÓÃÓÚ´¦Àí¼Ùɾ³ýµÄ£¬ÒòΪÓÐ׏ºÎï³µºÍ¶©µ¥µÄÐÅÏ¢²»·½±ãÖ±½Óɾ³ý£¬ËùÒÔÓëÖ®ÓйصÄÊý¾Ý¶¼ÊDzÉÓõļÙɾ³ýµÄ·½Ê½À´´¦ÀíµÄ¡£

±í3-5 ÉÌÆ·ÐÅÏ¢±í£¨goodsInfo£©

×Ö¶ÎÃû Id name remarks goodsTypeId trademarkId

unit imageUrl marketPrice memberPrice isrefinement isHost isDiscount createDate alertDate isEnable adminId

ÀàÐÍ Integer Varchar Varchar Integer Integer Varchar Varchar Float Float Boolean Boolean Boolean DateTime DateTime Int Integer

ÊÇ·ñÊÇÖ÷Íâ¼ü

ÊÇ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ

Ë÷Òý ÊÇ ÊÇ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ

ÊÇ·ñΪ¿Õ Not-null Not-null

Not-null Not-null

Not-null Not-null Not-null Not-null

×Ö¶ÎÃèÊö Ö÷¼üID ÉÌÆ·Ãû³Æ ÉÌÆ·½éÉÜ ÉÌÆ·ÀàÐÍid Æ·ÅÆid ¼ÆÊýµ¥Î» ÉÌƷͼƬ Êг¡¼Û¸ñ »áÔ±¼Û¸ñ ÊÇ·ñ¾«Æ· ÊÇ·ñÈÈÂô ÊÇ·ñÌØ¼Û ´´½¨Ê±¼ä ÐÞ¸Äʱ¼ä ÊÇ·ñ¿ÉÓà ´´½¨Õß

²ÎÕÕ±í ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª

±í3-5ÉÌÆ·ÐÅÏ¢±í£¨goodsInfo£©£¬ÓÃÓÚ´æ·ÅÉÌÆ·µÄ»ù±¾ÐÅÏ¢£¬±£´æÉÌÆ·µÄÃû³Æ¡¢¼ò½é¡¢Í¼Æ¬Â·¾¶¡¢ÏúÊÛ¼Û¸ñµÈµÈ¡£ÆäÖÐidΪÖ÷¼ü£¬²»ÄÜΪ¿Õ×Ô¶¯Ôö³¤£¬Æä´ÎÔÚ±¾±íÖÐÓÐ×ÅÁ½¸ö×ֶηֱðÊÇgoodsTypeIdºÍtrademarkId£¬ÕâÁ½¸Ä×ֶηֱðÓÃÓÚÍâ¼ü¹ØÁªÉÌÆ·µÄÀàÐͺÍÉÌÆ·µÄÆ·ÅÆ£¬¶ÔÓÚÉÌÆ·Íâ¼ü¹ØÁªÁËÉÌÆ·ÀàÐ͹ýºóÒ²ÊÇ¿ÉÒÔÖªµÀÉÌÆ·ËùÊôµÄÆ·ÅƵģ¬µ«ÊÇΪÁ˱ãÓÚ²éѯºÍ²Ù×÷£¬±¾±í½á¹¹Í¬Ñù¹ØÁªÁËÉÌÆ·µÄÆ·ÅÆ¡£adminIdÓÃÓÚ¹ÜÀíÆ·ÅƹÜÀíÔ±£¬×¢Ã÷¸ÃÉÌÆ·ÐÅÏ¢µÄ´´½¨Õß¡£×îºóisEnableͬÑùÊÇÓÃÓÚ´¦Àí¼Ùɾ³ýµÄ¡£

12

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ±í3-6 ¹ºÎï³µÐÅÏ¢±í£¨shopCart£©

×Ö¶ÎÃû Id

goodsInfoId memberId amount price createDate isEnable ÀàÐÍ Integer Integer Integer Int Float DateTime Int ÊÇ·ñÊÇÖ÷Íâ¼ü

ÊÇ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ Ë÷Òý ÊÇ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ÊÇ·ñΪ¿Õ Not-null Not-null Not-null Not-null Not-null Not-null Not-null ×Ö¶ÎÃèÊö Ö÷¼üID ÉÌÆ·Id »áÔ±Id ¹ºÂòÊýÁ¿ ¹ºÂòµ¥¼Û ´´½¨Ê±¼ä ÊÇ·ñ¿ÉÓà ²ÎÕÕ±í ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª

±í 3-6¹ºÎï³µÐÅÏ¢±í£¨shopCart£©£¬¸Ã±íÓÃÓÚ´æ·ÅÓû§¹ºÎï³µµÄ»ù±¾ÐÅÏ¢£¬°üÀ¨ÉÌÆ·ÐÅÏ¢ID¡¢»áÔ±ID¡¢¹ºÂòÊýÁ¿¡¢¹ºÂòµ¥¼Û¡¢´´½¨Ê±¼äµÈµÈ¡£ÆäÖÐidΪÖ÷¼ü£¬²»ÄÜΪ¿Õ²¢ÇÒ×Ô¶¯Ôö³¤¡£goodsInfoIdÓÃÓÚ¹ØÁªÉÌÆ·ÐÅÏ¢±í£¬±íʾ¼ÓÈ빺Îï³µµÄÉÌÆ·£¬memberIdÍâ¼ü¹ØÁª»áÔ±±í£¬ÓÃÓÚÇø·ÖÊÇÄÄÒ»¸ö»áÔ±Ìí¼ÓµÄ¹ºÎï³µÐÅÏ¢¡£amountΪ¹ºÂòÊýÁ¿£¬priceΪ¹ºÂòµ¥¼Û£¬×îºóisEnableͬÑùÊÇÓÃÓÚ´¦Àí¼Ùɾ³ýµÄ¡£

±í3-7 ¶©µ¥ÐÅÏ¢±í£¨orderInfo£©

×Ö¶ÎÃû Id OrderID goodsInfoId memberId Amount Price totalPrice receiverName receiverPhone receiverAddress

status createDate alertDate isEnable ÀàÐÍ Integer Varchar Integer Integer Int Float Float Varchar Varchar Varchar Int DateTime DateTime Int ÊÇ·ñÊÇÖ÷Íâ¼ü

ÊÇ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ Ë÷Òý ÊÇ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ·ñ ÊÇ·ñΪ¿Õ Not-null Not-null Not-null Not-null Not-null Not-null Not-null Not-null Not-null Not-null Not-null Not-null Not-null Not-null ×Ö¶ÎÃèÊö Ö÷¼üID ¶©µ¥ºÅ ÉÌÆ·ID »áÔ±Id ¹ºÂòÊýÁ¿ ¹ºÂòµ¥¼Û ¹ºÂò×Ü¼Û ÊÕ»õÈËÐÕÃû ÊÕ»õÈ˵绰 ÊÕ»õµØÖ· ״̬ ´´½¨Ê±¼ä ÐÞ¸Äʱ¼ä ÊÇ·ñ¿ÉÓà ²ÎÕÕ±í ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª ¡ª

±í 3-7¶©µ¥ÐÅÏ¢±í£¨orderInfo£©£¬¸Ã±íÓÃÓÚ´æ·Å¶©µ¥µÄÏà¹ØµÄÐÅÏ¢£¬°üÀ¨¶©µ¥ºÅ¡¢ÉÌÆ·ID¡¢»áÔ±ID¡¢¹ºÂòÊýÁ¿¡¢¹ºÂòµ¥¼Û¡¢¹ºÂò×ܼۡ¢ÊÕ»õÈËÏà¹ØÐÅÏ¢¡¢¹ºÎï״̬µÈµÈ¡£ÆäÖÐidΪÖ÷¼ü£¬²»ÄÜΪ¿Õ²¢ÇÒ×Ô¶¯Ôö³¤¡£goodsInfoIdÓÃÓÚ¹ØÁªÉÌÆ·ÐÅÏ¢±í£¬±íʾ¼ÓÈ빺Îï³µµÄÉÌÆ·£¬memberIdÍâ¼ü¹ØÁª»áÔ±±í£¬ÓÃÓÚÇø·ÖÊÇÄÄÒ»¸ö»áÔ±Ìí¼ÓµÄ¹ºÎï³µÐÅÏ¢¡£amountΪ¹ºÂòÊýÁ¿£¬priceΪ¹ºÂòµ¥¼Û¡£receiverName¡¢receiverPhone¡¢receiverAddress·Ö±ð´æ·Å×ÅÊÕ»õÈËÐÕÃû¡¢ÊÕ»õÈËÁªÏµ·½Ê½¡¢ÊÕ»õµØÖ·¡£Status±íʾ¹ºÎï״̬£¬×îÒª·ÖΪÈýÖÖ״̬£¬·Ö±ðΪ: È·ÈÏÖ§¸¶¡¢ÒѾ­·¢»õ¡¢È·ÈÏÊÕ»õ£¬×îºóisEnableͬÑùÊÇÓÃÓÚ´¦Àí¼Ù

13

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ɾ³ýµÄ¡£

3.3 ER¹Øϵͼ

ͼ3-1 ER¹Øϵͼ

ͼ3-1ER¹ØϵͼΪ±¾ÏµÍ³ERÄ£ÐÍͼ£¬¸ÃͼÇåÎúµØ·´Ó³Á˸÷¸öÖ÷±íÖ®¼ä¶ÔÓ¦¹Øϵ£¬ÒÔ¼°¸÷ÕűíµÄ±í½á¹¹£¬¶ÔÉè¼ÆϵͳÓкܴóµÄ°ïÖú¡£ÆäÖÐmember±íÓë±íorderInfoºÍ±íshopCartΪһ¶Ô¶àµÄ¶ÔÓ¦¹Øϵ£¬±íshopCartÓë±ímember¡¢±ígoodsInfoΪ¶à¶ÔÒ»µÄ¹Øϵ£¬±íorderInfoÓë±ímember¡¢±ígoodsInfoΪ¶à¶ÔÒ»µÄ¹Øϵ£¬±ígoodsInfoÓë±ígoodsType¡¢±íadmin¡¢±ítrademarkÊǶà¶ÔÒ»µÄ¹Øϵ¡£

14

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© 4 ϵͳ¸ÅÒªÉè¼Æ

±¾Õ½«Í¨¹ý¶Ôϵͳ¹¦ÄÜÄ£¿éͼºÍϵͳÁ÷³ÌͼµÄ·ÖÎöÀ´²ûÊö³ÌÐòµÄ×ÜÌåÉè¼Æ¡£ 4.1 ϵͳ¹¦ÄÜÄ£¿é½á¹¹Í¼·ÖÎö

ͼ4-1ϵͳ¹¦ÄÜÄ£¿éͼ

Èçͼ4-1ϵͳ¹¦ÄÜÄ£¿éͼϵͳ¹¦ÄÜÄ£¿éͼËùʾ£¬Õû¸öϵͳÖ÷Òª°üº¬ÉÌÆ·¹ºÂò¡¢µÇ¼ע²á¡¢¸öÈËÖÐÐÄ¡¢ºǫ́¹ÜÀíËĸö²¿·Ö¡£¶ÔÓÚÉÌÆ·µÄ¹ºÂò¶øÑÔ£¬ËùÓеÄÈ˶¼Äܹ»ä¯ÀÀϵͳÖеÄËùÓеÄÉÌÆ·²¢Ñ¡Ôñ×Ô¼ºÏëÒª¹ºÂòµÄÉÌÆ·£¬¶ÔÓÚÉÌÆ·µÄ¹ºÂòÓÐÁ½ÖÖ·½Ê½£¬¿ÉÒÔÔÚÑ¡ÔñÉÌÆ·µÄʱºò¾Í½øÐйºÂò£¬Ò²¿ÉÒÔ½«ÉÌÆ·¼ÓÈëµ½×Ô¼ºµÄ¹ºÎï³µÖÐÈ»ºóÔÚ¹ºÎï³µÖи¶·Ñ¹ºÂòÉÌÆ·£¬µ±È»ºóÃæ¶ÔÓÚ½«ÉÌÆ·¼ÓÈ빺Îï³µÒÔ¼°¹ºÂòÉÌÆ·¶¼ÊÇÐèÒª»áÔ±µÇ¼µÄ¡£¶ÔÓÚ×¢²áºÍµÇ¼¶øÑÔ£¬¸ù¾Ý²»Í¬µÄϵͳ½ÇÉ«£¬ÔòÓв»Í¬µÄ×¢²áºÍµÇ¼µÄ·½Ê½¡£±¾ÏµÍ³ÖзÖΪÈýÀà½ÇÉ«£ºÏµÍ³¹ÜÀíÔ±¡¢Æ·ÅƹÜÀíÔ±¡¢»áÔ±£¬ÆäÖÐϵͳ¹ÜÀíÔ±ÊÇϵͳÄÚÖõÄÓû§£¬²»ÄÜͨ¹ý×¢²á²úÉú£¬Æ·ÅƹÜÀíԱͨ¹ý×¢²á²úÆ·£¬ÔÚÆ·ÅƹÜÀíÔ±×¢²áµÄʱºòÐèÒª½«×Ô¼ºµÄÆ·ÅÆÐÅÏ¢Ò»Æð×¢²á£¬×¢²á³É¹¦¹ýºóµÈ´ýϵͳ¹ÜÀíÔ±µÄÉóºË¡£Æ·ÅƹÜÀíÔ±µÇ¼ϵͳ³É¹¦¹ýºóÔò¹ÜÀí×Ô¼ºµÄ»ù±¾ÐÅÏ¢ºÍÉÌÆ·ÐÅÏ¢£¬°üÀ¨£ºÆ·ÅÆÐÅÏ¢¡¢ÉÌÆ·ÀàÐÍ¡¢ÉÌÆ·ÐÅÏ¢¡¢¶©µ¥ÐÅÏ¢µÈ¡£¶ÔÓÚϵͳ»áÔ±Ò²ÊÇͨ¹ý×¢²á²úÉú£¬×¢²áʱÐèÒª¼òµ¥µÄÓû§ÃûºÍÃÜÂëÒÔ¼°ÓÊÏäµØÖ·£¬×¢²á³É¹¦¹ýºó²»ÐèÒªµÈ´ý¹ÜÀíÔ±µÄÉóºË±ã¿ÉÒԵǼ£¬µÇ¼³É¹¦¹ýºóÄܹ»¶Ô×Ô¼ºµÄ¸öÈËÖÐÐĽøÐйÜÀí£¬°üÀ¨¶Ô×Ô¼ºµÄ»ù±¾ÐÅÏ¢µÄ¹ÜÀí¡¢µÇ¼ÃÜÂë¡¢Ö§¸¶ÃÜÂëµÄ¹ÜÀíÒÔ¼°¹ºÎï³µºÍ¶©µ¥µÄ¹ÜÀí¡£¶ÔÓÚºǫ́¹ÜÀíÔòÐèÒªÒª¸ù¾Ý¹ÜÀíÔ±µÄȨÏÞÀ´È·¶¨£¬ÏµÍ³¹ÜÀíÔ±Ö÷ÒªÊǹÜÀíÆ·ÅƹÜÀí

15

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© Ô±£¬Æ·ÅƹÜÀíÔ±Ö÷ÒªÊǹÜÀíÆ·ÅÆϵÄÉÌÆ·ÀàÐÍ¡¢ÉÌÆ·ÐÅÏ¢¡¢¶©µ¥µÈµÈ¡£Õû¸öϵͳµÄ¼Ü¹¹²ÉÓÃ

4.2 ϵͳ¹¦ÄÜÁ÷³Ìͼ

ͼ 4-2 ϵͳ¹¦ÄÜÁ÷³Ìͼ

Èçͼ4-2 ϵͳ¹¦ÄܽṹͼËùʾ£¬±¾ÏµÍ³ËùÓÐÈ˶¼¿É½øÐÐä¯ÀÀºÍ²é¿´ÉÌÆ·ÐÅÏ¢£¬µ±ÐèÒª½«ÉÌÆ·¼ÓÈëµ½¹ºÎï³µ»òÕßÐèÒª¹ºÂòÉÌÆ·µÄʱºòÔòÐèÒª»áÔ±µÇ¼ϵͳ²ÅÐУ¬ÔڵǼµÄʱºò»á¶ÔÓû§µÄÓû§ÃûºÍÃÜÂë½øÐÐÅжϣ¬µÇ¼³É¹¦¹ýºó²ÅÄܽ«ÉÌÆ·¼ÓÈëµ½¹ºÎï³µÖкÍÉÌÆ·µÄ¹ºÂò£¬Í¬Ê±Ò²¿ÉÒÔ½øÈëµ½¸öÈËÖÐÐĹÜÀí¸öÈ˵ĸ÷ÏîÐÅÏ¢¡£Èç¹û»¹Ã»ÓлáÔ±Õ˺ÅÔò¿ÉÒÔ×¢²áÒ»¸ö£¬Í¨¹ý³É¹¦¹ýºó¼´¿ÉµÇ¼ϵͳ¡£ÔÚÉÌÆ·µÄ¹ºÂò¹ý³ÌÖлá¼ì²âÓû§ÊÇ·ñµÇ¼£¬Óû§Ã»ÓеǼÔòÌáʾÓû§½øÐеǼ£¬Èç¹ûÓû§ÒѾ­µÇ¼Ôò´¦ÀíÉÌÆ·µÄÊý¾Ý£¬È»ºó½øÐйºÂò£¬ÔÚ¹ºÂòÖ§¸¶µÄ¹ý³ÌÖлá¼ì²âÓû§µÄÕË»§Óà¶î£¬Èç¹ûÓà¶î²»×ã¾Í×÷³öÌáʾ£¬·´Ö®ÔòÖ±½Ó¹ºÂòÉÌÆ·³É¹¦¡£

¹ÜÀíÔ±·ÖΪÁ½Ààϵͳ¹ÜÀíÔ±ºÍÆ·ÅƹÜÀíÔ±£¬ÏµÍ³¹ÜÀíÔ±Ö÷Òª¹ÜÀíÆ·ÅƹÜÀíÔ±£¬ÉóºË¹ÜÀíÔ±¡¢É¾³ýµÈ£¬ÏµÍ³¹ÜÀíÔ±ÓÉϵͳÄÚÖá£Æ·ÅƹÜÀíÔ±ÓÐ×¢²áÉú³É£¬×¢²á³É¹¦ÔòµÈ´ýϵͳ¹ÜÀíÔ±µÄÉóºË£¬×¢²áʧ°ÜÔò·µ»Ø×¢²áÒ³Ãæ½øÐÐÖØÐÂ×¢²á¡£Æ·ÅƹÜÀíԱͨ¹ýÉóºË¹ýºó¾Í¿ÉÒԵǼµ½ÏµÍ³ºǫ́¡£

16

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© 5 ϵͳÏêϸÉè¼ÆÓëʵÏÖ

5.1 ¹«¹²Ä£¿éÉè¼ÆÓëʵÏÖ

±¾½Ú´ÓÒÔϼ¸¸ö·½Ãæ½øÐнéÉÜ£¬ÏêϸµÄ˵Ã÷Õû¸ö³ÌÐòµÄ¼Ü¹¹ºÍһЩ¹«¹²Ä£¿é£º 5.1.1 ³ÌÐòĿ¼½á¹¹

ͼ5-1ÏîĿĿ¼½á¹¹Í¼

Èçͼ5-1ÏîĿĿ¼½á¹¹Í¼Ëùʾ£¬Í¼ÖÐչʾÁ˸ÃϵͳµÄ´úÂëÒÔ¼°¸÷Ïî×ÊÔ´¡£´ÓsrcĿ¼ÏµÄorg.cde.edu.shopĿ¼ÏÂÄܹ»ºÜºÃµÄÀí½âÕû¸öϵͳµÄºËÐļܹ¹£¬ÔÚϵͳ¼Ü¹¹ÖвÉÓÃDao¡¢Service¡¢ControllerµÄ´¦Àí·½Ê½£¬½áºÏÒ³ÃæµÄView£¬±ãÊǵäÐ͵ÄMVCģʽ¡£DaoºÍServiceÖ÷Ҫͨ¹ýHibernate´¦ÀíÊý¾Ý³Ö¾Ã²ã£¬Controller×÷ΪºËÐÄ¿ØÖÆÆ÷£¬´¦ÀíϵͳµÄÒµÎñÂß¼­¡£

Óұ߲¿·ÖÊÇÏîÄ¿WebrootĿ¼½á¹¹£¬ÔÚ¸ÃĿ¼½á¹¹Ï´æ·ÅµÄÊÇÒ³ÃæÒÔ¼°Ò³ÃæµÄ×ÊÔ´¡£ 5.1.2 ϵͳÕûÌå¼Ü¹¹

¸Ãϵͳ²ÉÓõÄMVCµÄ±à³Ìģʽ£¬MVCģʽ£¨Model-View-Controller£©ÊÇÈí¼þ¹¤³ÌÖеÄÒ»ÖÖÈí¼þ¼Ü¹¹Ä£Ê½[9]£¬°ÑÈí¼þϵͳ·ÖΪÈý¸ö»ù±¾²¿·Ö£ºÄ£ÐÍ£¨Model£©¡¢ÊÓͼ£¨View£©ºÍ¿ØÖÆÆ÷£¨Controller£©¡£ÔÚ±¾ÏµÍ³µÄ¼Ü¹¹ÖÐÊÇÒÔHtml×÷ΪÊÓͼ²ã£¬Í¨¹ýFreeMarker×÷ΪҳÃæ±êÇ©À´´¦ÀíºÍչʾÊý¾Ý£¬Í¬Ê±ÔÚÒ»¶¨³Ì¶ÈÉÏʹÓÃJqueryµÄAjax´¦ÀíÊý¾ÝµÄ½»»¥²¢½áºÏJqueryµÄDOM²Ù×÷À´ÊµÏÖÒ³ÃæЧ¹û¡£¿ØÖÆÆ÷ÔòÊDzÉÓõÄSpringMvc£¬Í¨¹ý

17

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© SpringMvc×÷ΪºËÐÄ¿ØÖÆÆ÷´¦ÀíϵͳµÄËùÓеÄÒµÎñÂß¼­¡£Ä£ÐͲãÔòÊÇJavaBean£¬½áºÏDaoÓëServiceÖеÄHibernateÀ´´¦ÀíÊý¾Ý[8]¡£

5.1.3 baseDao½éÉÜ

BaseDaoÊÇÕû¸öϵͳÓëÊý¾Ý¿â½»»¥£¬´¦ÀíÊý¾ÝµÄºËÐĽӿڣ¬ÔڸýӿÚÖÐÉùÃ÷ÁËÐí¶àµÄ·½·¨£¬Í¨¹ýBaseDaoImpÀ´ÊµÏÖ£¬ÒÔ´Ë×÷ΪÕû¸öϵͳµÄºËÐÄ£¬ÔÚʵÏÖÀàÖÐÊÇͨ¹ýSpringµÄHibernateTemplateÀ´µ÷Óø÷ÖÖ·½·¨À´´¦ÀíÊý¾ÝµÄ¡£HibernateTemplateÊÇSpring¶ÔHibernateµÄSessionµÄ½øÒ»²½·â×°£¬Ê¹ÓÃHibernateTemplate ·Ç³£¼òµ¥¡£´´½¨Hi bernateTemplate ʵÀýºó£¬×¢ÈëÒ»¸öSessionFactory µÄÒýÓ㬾ͿÉÖ´Ðг־û¯²Ù×÷¡£SessionFactory ¶ÔÏó¿Éͨ¹ý¹¹Ôì²ÎÊý´«È룬»òͨ¹ýÉèÖµ·½Ê½´«Èë¡£ÏÂÃæ¶Ô¸Ã½á¹¹ÖеIJ¿·Ö·½·¨×öÒ»¶¨µÄ½éÉÜ¡£

£¨1£© ¸ù¾ÝÌõ¼þ»ñÈ¡Ò»ÌõÊý¾ÝµÄ·½·¨£¬ÔÚbasedaoÖÐÉùÃ÷ÁËÁ½¸ö·½·¨À´ÊµÏָù¦ÄÜ£º public T getEntity(String property,Object value); public T getEntity(String[] properties,Object[] values);

ÔÚÕâÁ½¸ö·½·¨ÖеÚÒ»¸öÊÇ´«ÈëÒ»¸öÊôÐÔÖµºÍÊôÐÔÃû³Æ£¬¸ù¾ÝÕâÒ»¸öÌõ¼þÈ¥²éѯÏàÓ¦µÄÊý¾Ý£¬Ö»·µ»ØÒ»ÌõÊý¾Ý¡£µÚ¶þ¸ö·½·¨ÔòÊǶàÌõ¼þ²éѯ£¬¸Ã·½·¨Á½¸ö²ÎÊý¶¼ÊÇÊý×飬µÚÒ»¸öÊý×éÊÇStringÀàÐÍ£¬´æ·ÅµÄÊÇ×Ö¶ÎÃûÊý×é¡£¸Ã·½·¨µÄµÚ¶þ¸ö²ÎÊýÊÇObjectÀàÐ͵ÄÊý×飬´æ·ÅµÄÊǶÔÓ¦×ֶεÄÖµ¡£ÔÚ¾ßÌåµÄ·½·¨ÊµÏÖÖÐͨ¹ý¶ÔÊý×éµÄÑ­»·Éú³É²éѯµÄhqlÓï¾ä¡£

£¨2£© ¸ù¾ÝÌõ¼þ»ñÈ¡Êý¾Ý¼¯ºÏµÄ·½·¨£¬ÔÚBaseDaoÖÐͬÑùÉùÃ÷ÁËÁ½¸ö·½·¨£¬Á½¸ö·½·¨ÈçÏ£º

public List getList(String property,Object value); public List getList(String[] properties,Object[] values);

µÚÒ»¸ö·½·¨ÐèÒªÁ½¸ö²ÎÊý£¬Ò»¸öÊÇ×Ö¶ÎÃû³ÆÁíÒ»¸öÊÇ×Ö¶ÎÃû³Æ¶ÔÓ¦µÄÖµ£¬Í¨¹ý¸Ãֵȥ²éѯÏàÓ¦µÄ×î½ü×îºó·µ»ØÒ»¸ölist¼¯ºÏ¡£µÚ¶þ¸ö·½·¨Í¬ÑùÊÇÐëÐèÒªÁ½¸ö²ÎÊý£¬µÚÒ»¸ö²ÎÊýÊÇStringÀàÐ͵ÄÊý×飬´æ·ÅµÄÊÇ×Ö¶ÎÃûÊý×é¡£¸Ã·½·¨µÄµÚ¶þ¸ö²ÎÊýÊÇObjectÀàÐ͵ÄÊý×飬´æ·ÅµÄÊǶÔÓ¦×ֶεÄÖµ¡£ÔÚ¾ßÌåµÄ·½·¨ÊµÏÖÖÐͨ¹ý¶ÔÊý×éµÄÑ­»·Éú³É²éѯµÄhqlÓï¾ä£¬×îºó·½·¨·µ»ØÒ»¸ölist¼¯ºÏ¡£

£¨3£© ·ÖÒ³²éѯ·½·¨

public Pager findByPager(Pager pager,String hql);

¸Ã·½·¨ÊµÏÖÁË·ÖÒ³²éѯµÄ£¬Ö÷ÒªÓ¦ÓÃÓÚÇ°¶ÎÒ³ÃæÐèÒªÏÔʾÁбíµÄʱºòÊý¾Ý¹ý´ó½øÐÐ

18

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ·ÖÒ³²Ù×÷µÄ£¬Ã¿´ÎÖ»²éѯµ±Ç°Ò³µÄÊý¾Ý¡£¸Ã·½·¨ÐèÒªÁ½¸ö²ÎÊý£¬µÚÒ»¸öÊÇ·ÖÒ³»ùÀàPager£¬ÁíÍâÒ»¸öÔòÊDzéѯµÄhqlÓï¾ä¡£ÎªÁË×öµ½Áé»î¶à±äÒÔ¼°ÊµÏÖ¸÷ÖÖÌõ¼þµÄ²éѯ£¬Õâ¶ùµÄ²éѯÓï¾äÓõ÷Óõķ½·¨Ìṩ£¬¸ù¾Ý²»Í¬µÄÒµÎñÂß¼­³ÌÐòÉè¼ÆÕß×Ô¼ºÊµÏÖ¡£

£¨4£© ΪÕë¶Ô·¢Õ¹µÄ²éѯÌõ¼þͬÑùµÄbasedaoÖÐÉùÃ÷ÁËÁ½¸ö·½·¨À´ÊµÏÖÕâÑùµÄ¹¦ÄÜ£¬Á½¸ö·½·¨¶¼Ö»ÐèÒª´«ÈëÒ»¸öhqlÓï¾ä£¬Í¨¹ý¾ßÌåµÄʵÏÖ£¬Á½¸ö·½·¨·Ö±ð·µ»ØÒ»ÌõÊý¾ÝºÍÒ»¸ölistÊý¾Ý¼¯ºÏ¡£·½·¨ÉùÃ÷ÈçÏ£º

public List getListBySql(String hql);

public T getEntityBySql(String hql); £¨5£© ÑéÖ¤ÊÇ·ñ´æÔÚ·½·¨

public Boolean isExists(String property,Object value);

¸Ã·½·¨ÉùÃ÷ҪʵÏֵŦÄÜÊÇÅжÏij¸öÖµÊÇ·ñ´æÔÚ¡£¸Ã·½·¨ÐèÒªÁ½¸ö²ÎÊý£¬Ò»¸öÊÇ×Ö¶ÎÃû³Æ£¬ÁíÒ»¸öÔòÊÇ×ֶζÔÓ¦µÄÖµ£¬×îºó·½·¨·µ»ØBooleanµÄtrueºÍfalse¡£ 5.1.4 ·ÖÒ³bean½éÉÜ

¾ø´ó¶àÊýϵͳ¶ÔÓÚÊý¾Ý¹ý´ó¶¼»á²ÉÓ÷ÖÒ³£¬ÔÚ¸ÃϵͳÖÐÒ²²ÉÓÃÁ˳£¹æµÄ·ÖÒ³£¬·ÖÒ³µÄ¸÷ÖÖÊý¾ÝÊÇͨ¹ýpagerÕâ¸öjavabeanÀ´±£´æµÄ¡£ÔÚPagerÖÐÓÐһϼ¸¸ö²ÎÊý£º

private Integer pageNumber = 1;// µ±Ç°Ò³Âë

private Integer pageSize = 15;// ÿҳ¼Ç¼Êý private Integer totalPage = 0;// ×ܼǼÊý private Integer pageCount = 0;// ×ÜÒ³Êý private String keyWord; //²éѯ¹Ø¼ü×Ör private List list;// Êý¾ÝList

ÈçÉÏ´úÂëËùʾ£¬pageNumber¼Ç¼µÄÊǵ±Ç°Ò³£¬pageSize¼Ç¼µÄÿһҳÏÔʾµÄÊý¾ÝÌõÊý£¬totalPage¼Ç¼µÄÊÇ×ܵÄÊý¾ÝÌõÊý£¬pageCount¼Ç¼µÄÊÇ×ܵÄÒ³Êý¡£ÕâЩÊý¾Ý¶¼ÊÇ·ÖÒ³ËùÐèÒªµÄ»ù±¾Êý¾Ý¡£keyWord´æ·ÅµÄÊÇËÑË÷¹Ø¼ü×ÖÓÃÓÚ²éѯʹÓ㬶ÔÓÚÕâ¸ö¹Ø¼ü×ÖµÄÉè¼ÆÊÇÕâÑù¿¼ÂǺÍʵÏֵģ¬µ¥Ìõ¼þ²éѯkeyWordÖоʹæ·Åµ¥¸öÖµ£¬¶àÌõ¼þ²éѯÔò½«²éѯÌõ¼þ·â×°³Éjson¸ñʽ£¬Óɺǫ́½âÎöÔÚ×é³ÉhqlÓï¾ä£¬ÒÔ´ËÀ´ÊµÏÖ¶àÌõ¼þ²éѯËÑË÷¡£ListÊôÐÔÊÇÓÃÀ´´æ·Å²éѯ·µ»ØµÄÊý¾ÝµÄ¡£

5.2ϵͳģ¿éʵÏÖ

ÔÚ±¾½ÚÖн«¶ÔϵͳµÄ¾ßÌåµÄ¹¦ÄܵÄÉè¼ÆºÍʵÏÖ×öÏêϸµÄ½éÉÜ£¬²¢¶ÔϵͳÍê³É¹ýºóËùÈ¡µÃµÄһЩЧ¹û½øÐÐչʾ¡£

19

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© 5.2.1 ÉÌƷչʾºÍ¹ºÂòÄ£¿é

±¾ÏµÍ³ÊÇÒÔÆ·ÅÆΪÖÐÐĽøÐÐչʾºÍ¹ÜÀíµÄ£¬ÏµÍ³ÄÚÖÃ7´óÀàÐÍ£¬ÔÚ7´óÀàÐÍÏÂÃæÓÐן÷ÖÖ¸÷ÑùµÄÆ·ÅÆ£¬ÔÚÆ·ÅƲÅÊǸ÷ÖÖÉÌÆ·µÄÀàÐÍ¡£ÕâÖÖÂß¼­¹ØϵºÜºÃµÄÌåÏÖÁËϵͳ×÷Ϊһ¸öƽ̨µÄÌص㡣

ͼ5-2 ÍøÕ¾Ê×ҳͼ

Èçͼ5-2ÍøÕ¾Ê×ҳͼËùʾ£¬Õû¸öµ¼º½Ìõ°´ÕÕÈÕÓðٻõ¡¢·þÊΡ¢µçÆ÷/¼Òµç¡¢ÊýÂë¡¢¼Ò¾ß½¨²Ä¡¢Æû³µ/Åä¼þ¡¢ÊÎÆ·ÕâÆß´óÀàÀ´½øÐÐչʾ£¬ÔÚÒ³ÃæµÄÓÒ±ßÔòÊÇÕâÆß´óÀàϵÄÆ·ÅƵĵ¼º½£¬Í¨¹ýÕâ¶ùÄܹ»Ìøתµ½Ä³Ò»¸öÆ·ÅƵÄչʾҳȥä¯ÀÀºÍÑ¡¹ºÉÌÆ·¡£ÔÚÆ·ÅƵÄչʾҳÊ×ÏÈÊÇͨ¹ýAjaxչʾËùÓеÄÉÌÆ·£¬ÔÚÆ·ÅƵÄչʾҳÄܹ»Í¨¹ý¸ÃÆ·ÅÆϵÄÀàÐÍÀ´É¸Ñ¡ÉÌÆ·ÐÅÏ¢¡£¶ÔÓÚÊ×Ò³ÏÔʾµÄÊý¾Ý´ó²¿·ÖÀ´×ÔÓÚJqueryµÄAjaxÇëÇó£¬È»ºóͨ¹ýJquery²Ù×÷DomÉú³É¶øÀ´£¬ºËÐÄ´úÂëÈçÏ£º

//²éѯ ÈÕÓðٻõ µÄËùÓÐÆ·ÅÆ

trademarks = trademarkService.getList(\if(trademarks!=null && trademarks.size()>0){ //½«ÐÅÏ¢´æ·Åµ½objectÖÐ object.put(\

object.put(\//½«object·ÅÈëµ½arrayÖÐ array.add(object); }

ÒÔÉÏ´úÂëÊDzéѯijһÖ÷ÀàÐÍϵÄÆ·ÅÆÐÅÏ¢£¬×îºó½«Ö÷ÀàÐÍÒÔ¼°Ö÷ÀàÐÍϵÄÆ·ÅÆÐÅÏ¢·â×°µ½Ò»¸öJsonObjectÖУ¬È»ºó´æ·Åµ½JsonArrayÊý×éÖС£×îºó½«7¸öÖ÷ÀàÐ͵ÄÆ·ÅÆ»ñ

20

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© È¡Í꣬JsonArrayÖеÄÊý¾Ý¾ÍÊÇÇ°¶ÎÏÔʾËùÐèµÄÊý¾Ý¡£

//Ñ­»·±éÀúdataÊý¾Ý£¬Éú³ÉÆ·ÅÆÐÅÏ¢

for(var i=0;i

//ÏÔʾ7¸öÖ÷ÀàÐÍ

html = '

'+data[i].title+'

';

$(\trademarks = data[i].trademarks; //ÏÔʾÖ÷ÀàÐÍϵÄÆ·ÅÆÐÅÏ¢Áбí for(var j=0;j

trademark = trademarks[j];

html = '

}}

$(\

ÒÔÉÏ´úÂëÊÇͨ¹ýAjaxÇëÇóÇ°ÃæËù½éÉܵķ½·¨£¬´ÓÄǸö·½·¨ÖлñÈ¡µ½Êý¾Ý£¬È»ºóÑ­»·

±éÀú³ö7¸öÖ÷ÒªµÄÀàÐÍ£¬ÅжÏÀàÐÍÏÂÃæÊÇ·ñ´æÔÚÆ·ÅÆ£¬Èç¹û ²»´æÔÚÆ·ÅÆÔò²»ÏÔʾ¸ÃÀàÐÍ£¬´æÔÚÆ·ÅÆÔòÏÔʾ£¬²¢ÔÚ¸ÃÀàÐÍÏÂÃæÑ­»·±éÀú³öËùÓеÄÆ·ÅÆ¡£

Ñ¡Ôñ×Ô¼ºÒªÑ¡¹ºµÄÉÌÆ·µã»÷ÉÌÆ·½øÈëµ¥¼þÉÌÆ·µÄչʾºÍ¹ºÂòÒ³£¬Ò³ÃæÈçÏ£º

ͼ5-3 ÉÌÆ·¹ºÂòÒ³

Èçͼ5-3 ÉÌÆ·¹ºÂòÒ³Ëùʾ£¬ÔÚÕâÒ»Ò³ÖÐÓû§¿ÉÒÔÇå³þµÄ²é¿´µ½ÉÌÆ·µÄÐÅÏ¢£¬Êó±êÒÆ

21

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ¶¯µ½×ó±ßµÄÉÌƷͼƬÉÏÃæÄܹ»ÇåÎúµÄ²é¿´ÉÌÆ·µÄÿһ¸öϸ½Ú¡£¶ÔÓÚ´óͼµÄ²é¿´ÔÚ´Ë´¦Ê¹ÓõÄÊÇeasyzoomµÄ²å¼þ£¬¶ÔÓÚͼƬµÄÉú³ÉÒâ¼û²å¼þµÄ³õʼ»¯ÊÇͨ¹ýÈçÏ´úÂëÀ´Íê³ÉµÄ£¬´úÂëÈçÏ£º

//»ñȡͼƬµÄ·¾¶

var images = $(\if(images!=null){ }

ÔÚ±¾Ò³µÄÖм䲿·ÖÔòÊÇÉÌÆ·µÄһЩÐÅÏ¢ºÍÏúÊÛ¼Û¸ñµÈ£¬Í¬Ê±ÌṩÁ˹ºÂòÊýÁ¿µÄ²Ù×÷ºÍÁ¢¼´¹ºÂò¡¢¼ÓÈ빺Îï³µµÄ²Ù×÷£¬×îÓÒ±ßÔòÊÇÍƼöµÄͬÀàÉÌÆ·¡£ÔÚÕâ¶ù£¬Óû§¿ÉÒÔÖ±½Ó¹ºÂòÉÌÆ·Ò²¿ÉÒÔ½«ÉÌÆ·¼ÓÈëµ½¹ºÎï³µ¡£ÔÚÕâ¸öÁ½¸ö²Ù×÷֮ǰ¶¼»á¼ì²éÓû§ÊÇ·ñÒѾ­µÇ¼£¬Èç¹ûÓû§Ã»ÓеǼ£¬Ò³Ã潫Ìøתµ½µÇ¼½çÃ棬µÇ¼³É¹¦¹ýºó½«·µ»Ø¸ÃÒ³Ã棬Óû§¿É¼ÌÐø²Ù×÷¡£ÒÔÉϲÙ×÷¶àÊýͨ¹ýJavascriptÀ´ÊµÏֵģ¬ºËÐÄ´úÂëÈçÏ£º

//Éú³ÉÌáʾÐÅÏ¢

var html = \ÄúÕýÔÚ½«\¼þ£¬µ¥¼ÛΪ\µÄ\ÉÌÆ·¼ÓÈëµ½¹ºÎï³µ,

//½âÎöͼƬµÄ·¾¶ images = eval(images); images = eval(\//ÉèÖÃͼƬ·¾¶

$(\$(\//³õʼ»¯²å¼þ

$('a.zoom').easyZoom();

ÊÇ·ñÈ·ÈϼÓÈ룿\

//½øÐÐÌáʾ

if(confirm(html)){//È·ÈϼÓÈ빺Îï²Å

var url = \

var date = \ajax(url,date,function(data){

//¼ÓÈë³É¹¦ if(data.status==1){

22

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£©

}

});

alert(\¼ÓÈ빺Îï³µ³É¹¦£¬Äã¿ÉÒÔÔÚ¸öÈËÖÐÐIJ鿴²¢¸¶·Ñ\

}else{ }

alert(\¼ÓÈ빺Îﳵʧ°Ü\

µ±Óû§µã»÷Á¢¼´¹ºÂòʱ£¬ÏµÍ³»á¸ù¾ÝÉÌÆ·ÐÅÏ¢ÒÔ¼°Óû§Éè¼ÆµÄ¹ºÂòÊýÁ¿Éú³ÉÌáʾÐÅÏ¢£¬ÌáʾÓû§ÊÇ·ñ¹ºÂò¡£µ±Óû§È·ÈϹºÂò¹ýºóÐèÒªÓû§ÊäÈ벿·ÖÐÅÏ¢£¬ÈçÏÂͼËùʾ£º

ͼ5-4 Ö§¸¶Ò³

Èçͼ5-4Ö§¸¶Ò³Ëùʾ£¬ÔÚ½øÐÐ×îºóÖ§¸¶Ï¶©µ¥µÄʱºòÐèÒªÓû§²¹È«ÐÅÏ¢ºÍÊäÈëÖ§¸¶ÃÜÂ룬ÆäÖеÄÐÅÏ¢À´×ÔÓÚ»áÔ±µÄ»ù±¾ÐÅÏ¢£¬´Ë´¦¿É×öÐ޸ģ¬ÔÚ¶©µ¥ÖÐÒÔ×Ö·û´®´æ·Å£¬Óë»áÔ±±íûÓÐʵÖÊÐÔ¹Øϵ¡£ÔÚÌîдÍêÐÅÏ¢¹ýºóϵͳͨ¹ýJqueryµÄAjax½«Êý¾ÝÌá½»¸ø·þÎñÆ÷¡£ÔÚ·þÎñÆ÷¶ËÊ×ÏÈͨ¹ýÈçÏ´úÂ룺

DigestUtils.md5Hex(payPassWord).equals(member.getPayPassWord()) float price = goodsInfo.getMemberPrice(); price = price*number; if(price<=member.getCash()){}

Ê×Ïȼì²âÖ§¸¶ÃÜÂëÊÇ·ñÕýÈ·£¬ÔÚÖ§¸¶ÃÜÂëµÄ¼ì²â¹ý³ÌÖÐʹÓÃÁËDigestUtilsµÄmd5Hex·½·¨¶ÔÃÜÂë½øÐмÓÃÜ¡£µ±Ö§¸¶ÃÜÂëÕýÈ·¹ýºóÔÙ¼ì²âÓà¶îÊÇ·ñ×ã¹»Íê³É´Ë´Î½»Ò×£¬²»×ãÔò·µ»ØÒ³Ãæ²¢×÷³öÌáʾ£¬×ã¹»µÄ½øÐйºÂò¡£ÕâÀï²ÉÓõÄÊÇÒ»¸öÄ£ÄâµÄÖ§¸¶·½Ê½£¬²¢²»Éæ¼°ÕæʵµÄ½ðÇ®½»Òס£¶ÔÓÚÑ¡Ôñ¼ÓÈ빺Îï³µ²Ù×÷µÄ»°£¬ÏµÍ³»á½«¸ÃÉÌÆ·°´ÕÕÓû§Ñ¡ÔñµÄÊýÁ¿

23

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ¼ÓÈëµ½×Ô¼ºµÄ¹ºÎï³µÖС£

5.2.2 ¸öÈËÖÐÐÄÄ£¿é

Óû§µÇ¼³É¹¦¹ýºó¿ÉÒÔ½øÈëµ½¸öÈËÖÐÐÄ£¬ÔÚ¸öÈËÖÐÐÄÓû§¿ÉÒÔ¶Ô×Ô¼ºµÄһЩ»ù±¾ÐÅÏ¢¡¢ÃÜÂë¡¢¹ºÎï³µ¡¢¶©µ¥µÈ½øÐйÜÀí£¬ÈçÏÂͼËùʾ£º

ͼ5-5 ¸öÈËÖÐÐÄͼ

Èçͼ5-5 ¸öÈËÖÐÐÄͼËùʾ£¬ÔÚ¸öÈËÖÐÐÄÓû§¿ÉÒÔ¶Ô¸öÈËÐÅÏ¢¡¢¹ºÎï³µÐÅÏ¢¡¢¶©µ¥ÐÅÏ¢½øÐйÜÀí¡£ÔÚ¸öÈËÐÅÏ¢¹ÜÀíÖпÉÒÔÐ޸ĸöÈËÐÅÏ¢¡¢Ð޸ĵǼÃÜÂë¡¢ÐÞ¸ÄÖ§¸¶ÃÜÂ룻ÔÚ¹ºÎï³µÐÅÏ¢ÖÐÓû§Äܹ»²é¿´×Ô¼ºµÄ¹ºÎï³µÖеÄÉÌÆ·£¬²¢ÇÒÄܹ»½øÐÐÖ§¸¶¹ºÂò¡£¶©µ¥ÐÅÏ¢¹ÜÀíÖÐÓû§Äܹ»²é¿´×Ô¼ºµÄ¹ºÂò¼Ç¼£¬Äܹ»Á˽⵽¹ºÂòµÄÉÌÆ·µÄ·¢»õ״̬£¬µ±ÊÕ»õ¹ýºóÐèÒªÔÚÕâÀïÈ·ÈÏÊÕ»õ¡£

5.2.3 ×¢²áµÇ¼ģ¿é

¶ÔÓÚ±¾ÏµÍ³¶øÑÔ£¬»áÔ±ÓëÆ·ÅƹÜÀíÔ±¶¼ÊÇͨ¹ý×¢²á²úÉúµÄ£¬»áÔ±¡¢Æ·ÅƹÜÀíÔ±¡¢ÏµÍ³¹ÜÀíÔ±¶¼ÓµÓеǼ¹¦ÄÜ£¬µÇ¼³É¹¦¹ýºó¸ù¾Ý²»Í¬µÄ½ÇÉ«Óв»Í¬µÄ¹ÜÀíÏî¡£ÔÚ»áÔ±×¢²áµÄʱºòÐèÒªÌîÈëµÄÓÐÐÅÏ¢·Ö±ðΪÓû§Ãû¡¢ÃÜÂë¡¢ÓÊÏäµØÖ·£¬ÃÜÂëÊǾ­¹ýMD5¼ÓÃܱ£´æµ½Êý¾ÝÖеģ¬²¢ÇÒÓû§ÃûºÍÓÊÏäµØÖ·¶¼²»ÄÜΪ¿Õ¡£Æ·ÅƹÜÀíÔ±µÄ×¢²áÏà¶Ô¶øÑÔÄÚÈÝ»á¶àһЩ£¬ÔÚÕË»§µÄ×¢²áµÄ¹ý³ÌÖÐÐèÒªÐÂÌí¼ÓÆ·ÅÆ£¬¹ÜÀíÔ±Õ˺źÍÆ·ÅÆÐÅÏ¢Ò»ÆðÌí¼ÓÀ´Íê³ÉµÄ£¬ÈçÏÂͼ£º

24

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£©

ͼ5-6 Æ·ÅƹÜÀíÔ±×¢²áͼ

Èçͼ5-6Æ·ÅƹÜÀíÔ±×¢²áͼËùʾ£¬ÔÚ×¢²áµÄʱºòÐèÒªÌîÈë»ù±¾µÄÓû§ÐÅÏ¢Óû§ÃûºÍÃÜÂ룬ͬʱ»¹ÐèÒªÌí¼ÓÆ·ÅƵÄÐÅÏ¢£¬°üÀ¨Æ·ÅƵÄÃû³Æ¡¢Æ·ÅÆÀàÐÍ¡¢Æ·ÅÆͼ±êµÈµÈ¡£Óû§Ãû¡¢ÃÜÂ롢ƷÅÆÃû³Æ²»ÄÜΪ¿Õ£¬ÕâЩԼÊøÌõ¼þÊÇͨ¹ýJavascriptºÍJqueryÑéÖ¤µÄ¡£¶ÔÓÚÆ·ÅÆͼ±êµÄÉÏ´«£¬Ê¹ÓõÄÊÇÉÏ´«²å¼þ£¬ÉÏ´«²å¼þÖеIJ¿·ÖʼþÅäÖÃÈçÏ£º

//¼ì²âFLASHʧ°Üµ÷Óà 'onFallback' : function() {

},

//ÉÏ´«µ½·þÎñÆ÷£¬·þÎñÆ÷·µ»ØÏàÓ¦ÐÅÏ¢µ½dataÀï 'onUploadSuccess' : function(file,data, response) { },

//°ÑÎļþÃû´«¸øºǫ́

'onUploadStart' : function(file) {

$(\$(\

alert(\Äúδ°²×°FLASH¿Ø¼þ£¬ÎÞ·¨ÉÏ´«Í¼Æ¬£¡Çë°²×°FLASH¿Ø¼þºóÔÙÊÔ¡£\

$(\¶ÔÓÚϵͳµÄµÇ¼»áÔ±ºÍ¹ÜÀíÔ±µÄ²Ù×÷»ù±¾Ïàͬ£¬Ö»ÓÐÔڵǼ³É¹¦¹ýºó¶ÔÓ¦µÄ´¦ÀíÏî

25

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ²»Í¬¡£ÔÚÕâÈýÖÖϵͳ½ÇÉ«µÇ¼µÄʱºò¶¼ÐèÒªÌîдÓû§Ãû¡¢ÃÜÂë¡¢ÑéÖ¤Â룬²¢ÇÒÔÚÇ°¶Ë»á¶ÔÕâЩÄÚÈݲÉÓÃJavascriptºÍJquery×ö¼òµ¥µÄÑéÖ¤£¬±£Ö¤ÌîдµÄÐÅÏ¢²»Îª¿Õ¡£±íµ¥Ìá½»µ½ºǫ́£¬Ê×ÏÈÅжÏÑéÖ¤ÂëÊÇ·ñÕýÈ·£¬²»ÕýÈ·ÔòÖ±½Ó·µ»Ø£¬ÑéÖ¤ÂëÕýÈ·¹ýºóÔÙ²éѯÊý¾Ý¿â¿´Êý¾ÝÊÇ·ñ´æÔÚ£¬ÐèҪ˵Ã÷µÄÊÇÓÉÓÚÃÜÂë²ÉÓùýMD5¼ÓÃÜ£¬ËùÒÔÔÚ½øÐÐÃÜÂë±È¶ÔÇ°Ò²ÐèÒª¶ÔÊäÈëµÄÃÜÂë½øÐÐMD5¼ÓÃÜ¡£µÇ¼ºËÐÄ´úÂëÈçÏ£º

if(check.equals(s_code)){ //ÑéÖ¤ÂëÏàµÈ

if(StringUtils.isNotEmpty(password)){ }

//¸ù¾ÝÓû§ÃûºÍÃÜÂë²éѯÓû§

Admin admin = adminService.getEntity(new

String[]{\

if(admin!=null){ //Óû§´æÔÚ

session.setAttribute(\return \

password = DigestUtils.md5Hex(password);

}else { //Óû§²»´æÔÚ

model.addAttribute(\Óû§Ãû»òÃÜÂë´íÎó»òÕßÓû§²»¿ÉÓÃ\return \

}}else { //ÑéÖ¤Âë²»µÈ }

model.addAttribute(\ÑéÖ¤Âë´íÎó\return \

5.2.4 ϵͳ¹ÜÀíÔ±ºǫ́¹ÜÀíÄ£¿é

¶ÔÓÚºǫ́¹ÜÀíÄ£¿é¸ù¾Ý¹ÜÀíÔ±²»Í¬µÄϵͳ½ÇÉ«ÓÐ×Ų»Í¬µÄ¹¦ÄÜÄ£¿éϵͳ¹ÜÀíÔ±¹ÜÀíÕâÒ»²¿·ÖÄÚÈÝ£¬Æ·ÅƹÜÀíÔ±¹ÜÀí×ÅÒ»²¿·ÖÄÚÈÝ£¬ÏÂÃæÊÇϵͳ¹ÜÀíÔ±µÄ¹ÜÀíÄÚÈÝ£¬ÈçͼËùʾ£º

26

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ͼ5-7 ϵͳ¹ÜÀíÔ±¹ÜÀíÄÚÈÝͼ

Èçͼ5-7ϵͳ¹ÜÀíÔ±¹ÜÀíÄÚÈÝͼËùʾ£¬ÏµÍ³¹ÜÀíÔ±×ܹ²ÓµÓÐËĸö´óµÄ¹¦ÄÜÄ£¿é£¬·Ö±ðÊǸöÈËÐÅÏ¢¹ÜÀí£¬¹ÜÀíÔ±¹ÜÀí¡¢Æ·ÅÆÐÅÏ¢¹ÜÀí¡¢ÉÌÆ·ÐÅÏ¢¹ÜÀí¡£ÆäÖеĸöÈËÐÅÏ¢¹ÜÀí°üÀ¨Í·ÏñµÄÐ޸ĺÍÃÜÂëά»¤£¬ÒòΪϵͳ¹ÜÀíÔ±Õ˺ÅÊÇϵͳÄÚÖõÄÕ˺ţ¬ËùÒÔϵͳ¹ÜÀíÔ±µÄÕ˺ÅÊDz»ÌṩÐ޸ĵġ£¶ÔÓÚÍ·ÏñµÄÐÞ¸ÄÊDzÉÓÃAjaxµÄ·½Ê½ÉÏ´«Îļþ£¬×îºó¸Ä±äÏÖÓÐÍ·ÏñImg±êÇ©ÖеÄSrc·¾¶À´ÏÔʾͼƬµÄÏÔʾ¡£¶ÔÓÚheader²¿·ÖµÄÍ·ÏñµÄÐÞ¸ÄÊDzÉÓÃJavascriptµÄÈçÏ´úÂëÀ´ÊµÏֵģ¬»ù±¾Ë¼ÏëÊÇͨ¹ýWindow¶ÔÏó»ñÈ¡¸¸¼¶µÄframe£¬window.parent.frames['topFrame'].document.getElementById('header').src£¬Í¨¹ýÉÏÃæµÄ´úÂë¾ÍÄÜÐÞ¸ÄheaderÀïµÄÍ·ÏñÁË¡£¶ÔÓÚÃÜÂëµÄά»¤£¬ÐèÒªÊäÈëԭʼÃÜÂëºÍÐÂÃÜÂ룬ÐÂÃÜÂëÐèÒªÊäÈëÁ½´Î£¬µ±Ô­Ê¼ÃÜÂëÊäÈëÕýÈ·µÄʱºò£¬²Å½«ÐÂÃÜÂë¼ÓÃܲ¢¸üе½Êý¾Ý¿â¡£

ͼ5-8 Æ·ÅƹÜÀíÔ±¹ÜÀíͼ

Èçͼ5-8Æ·ÅƹÜÀíÔ±¹ÜÀíͼËùʾΪƷÅƹÜÀíÔ±¹ÜÀíµÄ¹¦ÄÜÄ£¿é£¬ÁбíÐÅÏ¢ÖÐÇåÎúµÄչʾÁ˹ÜÀíÔ±µÄһЩ»ù±¾ÐÅÏ¢ºÍ¹ÜÀíÔ±Õ˺ÅÊÇ·ñ¿ÉÓá£ÔÚ¸ÃÄ£¿éÖÐÓµÓÐÁ½¸ö¹¦ÄÜ£¬ÆäÒ»ÊǹÜÀíÔ±ÐÅÏ¢µÄÐ޸ģ¬Õâ¶ù²¢²»ÄܶÔƽƷÅƹÜÀíÔ±µÄÐÅÏ¢½øÐÐÐ޸ģ¬¶øÊǶÔÆ·ÅƹÜÀíÔ±µÄ״̬½øÐе÷Õû£¬»ù±¾É϶¼ÊÇÉóºËͨ¹ýºÍ»Ø¸´ÕË»§µÄ¿ÉÓÃÐС£Æä¶þÊÇɾ³ýÆ·ÅƹÜÀíÔ±£¬ÔÚ±¾ÏµÍ³Öд󱾷ÖÊý¾ÝÊDzÉÓüÙɾ³ýµÄ˼ÏëÀ´´¦ÀíµÄ£¬ÔÚÕâ¶ùÒ²ÊÇÕâÑù´¦ÀíµÄ¡£µ±Ö´ÐÐ

27

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ɾ³ý²Ù×÷µÄʱºò£¬Êµ¼ÊÉÏÊǶÔisEnable½øÐÐÐ޸ģ¬È»ºó¸üÐÂÊý¾Ý£¬Ê¹Óû§²»¿ÉÓ᣺ËÐÄ´úÂëÈçÏ£º

//ͨ¹ý<#list>±êÇ©Ñ­»·±éÀúÏÔʾÊý¾Ý

<#list pager.list as admin>

${(admin.id)!} ${(admin.name)!}

//ÅжÏÊÇ·ñÉóºË

<#if (admin.isEnabled==0) >δÉóºË<#else>¿ÉÓÃ

//ÏÔʾ²Ù×÷µÄͼ±ê

ͼ5-9 Æ·ÅÆÐÅÏ¢¹ÜÀíͼ

Èçͼ5-9Æ·ÅÆÐÅÏ¢¹ÜÀíͼËùʾ£¬¶ÔÓÚÆ·ÅƵĹÜÀíͬÑùÖ»ÓÐÐ޸ĺÍɾ³ý¹¦ÄÜ£¬ÏµÍ³¹ÜÀíÔ±¶ÔÓÚÆ·ÅƵĹÜÀíÆäʵҲ²»ÊDZØÐ룬ÓÉÓÚÆ·ÅÆÊÇ×÷ΪÕû¸öϵͳµÄ¹ÜÀí¹ÜÀí£¬ËùÒÔÔÚϵͳµÄ¹ÜÀíÏîÖÐÒ²Ìí¼ÓÁ˶ÔÆ·ÅƵĹÜÀí£¬µ«ÊDz¢²»Ìṩ¶ÔÆ·ÅƵÄÌí¼Ó¹¦ÄÜ¡£

28

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ͼ5-10 ÉÌÆ·ÐÅÏ¢¹ÜÀíͼ

Èçͼ5-10 ÉÌÆ·ÐÅÏ¢¹ÜÀíͼËùʾ£¬ÉÌÆ·ÐÅÏ¢¹ÜÀí·ÖΪÉÌÆ·ÐÅÏ¢¹ÜÀíºÍϼÜÉÌÆ·ÐÅÏ¢¹ÜÀí£¬ÔÚ´Ë´¦Í¬ÑùÖ»ÌṩÁËÐ޸ĺÍɾ³ýÁ½¸ö¹¦ÄÜ£¬É¾³ýͬÑùÊÇͨ¹ýisEnableÀ´ÊµÏֵļÙɾ³ý¡£Ï¼ÜÉÌÆ·µÄ¹ÜÀíÔòÊÇisEnableΪ0µÄÉÌÆ·£¬ÕâÏÄÜÖ»ÊÇÒ»¸öչʾ¹¦ÄÜ£¬ÈùÜÀíÔ±Á˽⵽ÄÄЩÉÌÆ·ÒѾ­Ï¼ܡ£

5.2.5 Æ·ÅƹÜÀíÔ±¹ÜÀíÄÚÈÝÄ£¿é

¶ÔÓÚÆ·ÅƹÜÀíÔ±¶øÑÔÔòÊǹÜÀí×Ô¼ºÆ·ÅÆϵÄËùÓеÄÉÌÆ·ÒÔ¼°Ò»Ð©ÆäËüµÄÐÅÏ¢£¬ÔÚÕâÒ»½ÚÖн«ÏêϸµÄ½éÉÜÕâЩÄÚÈÝ£¬¶ÔÓÚϵͳ¹ÜÀíԱģ¿éÖÐÒѾ­ÓнéÉܵÄÄ£¿éÔò×ö¼òµ¥½éÉÜ¡£

ͼ5-11 Æ·ÅƹÜÀíÔ±¹ÜÀíͼ

Èçͼ5-11Æ·ÅƹÜÀíÔ±¹ÜÀíͼËùʾ£¬Æ·ÅƹÜÀíÔ±ÓµÓÐ×ÅËĸö¹ÜÀíÄ£¿é£¬·Ö±ðÊǸöÈËÐÅÏ¢¹ÜÀí¡¢ÀàÐÍÐÅÏ¢¹ÜÀí¡¢ÉÌÆ·ÐÅÏ¢¹ÜÀí¡¢¶©µ¥ÐÅÏ¢¹ÜÀí¡£

¶ÔÓÚ¸öÈËÐÅÏ¢¹ÜÀíÄ£¿éÖÐÊǸöÈËÍ·ÏñµÄÐ޸ĺÍÃÜÂëµÄά»¤£¬ÕâÁ½¸ö¹¦ÄÜÄ£¿éÓëϵͳ¹ÜÀíÔ±µÄÏàͬ£¬ÔÚϵͳ¹ÜÀíÔ±¹ÜÀíÖÐÒѾ­ÏêϸµÄ×ö¹ý½éÉÜ¡£

29

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£©

ͼ5-12 ÉÌÆ·ÀàÐ͹ÜÀíͼ

Èçͼ5-12ÉÌÆ·ÀàÐ͹ÜÀíͼËùʾ£¬ÉÌÆ·ÀàÐ͹ÜÀí²ÉÓõÄÊÇÊ÷ÐνṹÀ´Õ¹Ê¾µÄ£¬ÕâÒ²ºÜºÃµÄÌåÏÖÁËÉÌÆ·ÀàÐÍÎÞÏÞ·ÖÀàµÄ±í½á¹¹¡£¸ÃÊ÷ÐνṹµÄ¸ù½ÚµãÊÇÆ·ÅÆÃû³Æ£¬ËùÓеÄÉÌÆ·ÀàÐͶ¼ÊǸÃÆ·ÅƵÄ×ÓÀàÐÍ¡£ÔÚÊ÷ÐνṹÉϵã»÷ÓÒ¼üÄܹ»ÏÔʾ³öÓÒ¼ü²Ëµ¥£¬¸Ã²Ëµ¥Öаüº¬Ìí¼Ó½Úµã¡¢Ð޸Ľڵ㡢ɾ³ý½ÚµãÈý¸ö¹¦ÄÜÑ¡Ïµã»÷Ìí¼Ó½Úµã¾Í»áµ¯³öÓұߵãµÄÌí¼Ó½çÃæÀ´ÊµÏÖ½ÚµãµÄÌí¼Ó¡£Ê÷µÄ³õʼ»¯´úÂëÈçÏ£º

loadTree: function() { //¼ÓÔØÊ÷()

//ͨ¹ýAjax»ñÈ¡Êý¾Ý

$.ajax({

url: \type: \dataType: \cache: false,

success: function(data) {//Êý¾Ý»ñÈ¡³É¹¦¡¢³õʼ»¯Ê÷Ðνṹ }

tree.zTree = $(\

});},

¶ÔÓÚÉÌÆ·µÄ¹ÜÀí£¬Æ·ÅƹÜÀíÔ±ÓµÓÐÌí¼ÓÉÌÆ·ÐÅÏ¢¡¢ÐÞ¸ÄÉÌÆ·ÐÅÏ¢¡¢É¾³ýÉÌÆ·ÐÅÏ¢¡¢¹ÜÀíϼÜÉÌÆ·ÐÅÏ¢µÈ¹¦ÄÜ£¬ÔÚϵͳ¹ÜÀíÔ±¹ÜÀíÄÚÈÝÖÐÒѾ­×ö¹ý½éÉÜ£¬ÔÚ´Ë´¦¾Í²»ÔÚÏêϸ½éÉÜ¡£

30

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£©

ͼ5-13 ¶©µ¥ÐÅÏ¢¹ÜÀíͼ

Èçͼ5-13 ¶©µ¥ÐÅÏ¢¹ÜÀíͼËùʾ£¬¶©µ¥ÐÅÏ¢¹ÜÀíÖÐÄܹ»ºÜÇå³þµÄÁ˽⵽ÿһ´Î¶©µ¥µÄÉÌÆ·Ãû³Æ¡¢¹ºÂòµ¥¼Û¡¢¹ºÂòÊýÁ¿¡¢Ïû·Ñ×ܽð¶îºÍ״̬¡£µ±»¹Î´·¢»õʱÄܹ»Í¨¹ýÁбíÖеIJÙ×÷À´Ä£Äâ·¢»õµÄ¹¦ÄÜ¡£

31

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© 6 ÖØÄѵã·ÖÎö¼°½â¾ö·½°¸

6.1 HibernateTemplateµÄÓ¦ÓÃ

HibernateTemplateÊÇorg.springframework.orm.hibernate3°üϵÄÒ»¸öÀ࣬ÊÇSpring¶ÔJDBC¸ü¼ÓÉî²ã´ÎµÄ·â×°£¬¼«´óµÄ·½±ãÁËͨ¹ýHibernate¶ÔÊý¾Ý¿âµÄ²Ù×÷[10]¡£

±¾ÏµÍ³ÖжÔHibernateTemplateµÄʹÓö¼ÊÇ·â×°ÔÚBaseDaoImpÖеģ¬¸ÃÀà¼Ì³Ð×ÔHibernateDaoSupport[11]£¬HibernateDaoSupportÐèҪעÈëÒ»¸öSessionFactory£¬ÔÚBaseDaoImpÖÐÎÒͨ¹ýsetSuperSessionFactory(SessionFactory sessionFactory)·½·¨½«SessionFactory×¢Èëµ½¸ÃÀàÖС£HibernateDaoSupportÀàÖÐÓÐÒ»¸ögetHibernateTemplateµÄ·½·¨£¬Í¨¹ý¸Ã·½·¨Äܹ»»ñÈ¡µ½HibernateTemplate£¬»ñÈ¡µ½HibernateTemplate¹ýºó£¬Ôòͨ¹ýËüÀ´²Ù×÷Êý¾Ý¿â£¬ÏÂÃæ¶ÔBaseDaoImpÖÐÓõ½µÄ¼¸¸ö·½·¨×ö¼òµ¥µÄ½éÉÜ¡£

HibernateTemplate¶ÔÓÚ¼òµ¥µÄSave¡¢Update¡¢DeleteÕâЩ·½·¨£¬Í¬ÑùÊÇ´«ÈëÒ»¸öʵÌå¶ÔÏ󣬾ÍÄܹ»Íê³ÉÏàÓ¦µÄ²Ù×÷£¬ÁíÍâÒ»¸ö·½·¨ÊÇFind·½·¨£¬Õâ¸ö·½·¨ÐèÒªÒ»¸öHQL¸ñʽµÄ²éѯÓï¾ä£¬²¢ÇÒÕâ¸ö·½·¨Ö±½Ó·µ»ØÒ»¸öListÊý¾Ý¼¯ºÏ£¬ÕâÑù¾Í¿ÉÒÔͨ¹ýHibernateTemplateÍê³É¼òµ¥µÄÔöɾ²é¸Ä¹¦ÄÜÁË¡£ÔÚBaseDaoImpÕâ¸öÀàÖÐʹÓÃ×î¶àµÄ·½·¨ÊÇFindByNamedParam·½·¨£¬²¢ÇÒÕâ¸ö·½·¨ÓжàÖÖµÄÖØÔØÐÎʽ£¬ÔÚ±¾ÏµÍ³ÖÐÖ÷ÒªÊÇÁËÁËÁ½ÖÖ£¬ÔÚ±¾ÏµÍ³Ê¹ÓõÄÕâÁ½ÖÖ¶¼ÐèÒªÈý¸ö²ÎÊý²¢ÇÒ¶¼ÊÇ·µ»ØÒ»¸öList¼¯ºÏ£¬µÚÒ»ÖÖÊÇorg.springframework.orm.hibernate3.HibernateTemplate.findByNamedParam(String queryString, String[] paramNames, Object[] values) throws DataAccessException

ÓÐÈçÉÏ´úÂë¿ÉÒÔ¿´³ö¸Ã·½·¨ÐèÒªµÄµÚÒ»¸ö²ÎÊýÊÇÒ»¸ö²éѯÓï¾ä£¬¸Ã²éѯÓï¾äÀàËÆÓÚHibernateµÄHQLÓï¾ä[12]£¬Ö»ÊÇÔÚ²éѯÓï¾äÖÐʹÓõÄÊÇparamName=£ºparamNameÕâÖÖ¸ñʽ£¬µÚ¶þ¸ö²ÎÊýÊÇÒ»¸öStringÀàÐ͵ÄÊý×飬¸ÃÊý×Ö´æ·ÅµÄÊÇ×Ö¶ÎÃû³ÆµÄ¼¯ºÏ£¬µÚÈý¸ö²ÎÊýΪһ¸öObjectµÄÊý×飬´æ·ÅµÄÊÇÿһ¸ö×Ö¶ÎËù¶ÔÓ¦µÄValueÖµ£¬°´ÕÕÏàÓ¦µÄ¹æ¶¨´«ÈëÈý¸ö²ÎÊý£¬HibernateTemplateÄÚ²¿»á×Ô¶¯µÄ·â×°ºÃÏàÓ¦µÄ²éѯÓï¾ä£¬×îºóͨ¹ý²éѯµÃµ½Ò»¸öListµÄÊý¾Ý¼¯ºÏ£¬²¢ÇÒ·µ»Ø¸ø¸Ã·½·¨µÄµ÷ÓÃÕß¡£ÐèҪ˵Ã÷µÄÊÇÕâ¸ö·½·¨»áÅ׳öÒ»¸öDataAccessExceptionÒì³££¬DataAccessExceptionÊÇRuntimeException£¬ÊÇÒ»¸öÎÞÐë¼ì²âµÄÒì³££¬²»ÒªÇó´úÂëÈ¥´¦ÀíÕâÀàÒì³££¬×ñÑ­ÁËSpringµÄÒ»°ãÀíÄÒì³£¼ì²â»áʹ´úÂëµ½´¦ÊDz»Ïà¹ØµÄcatch»òthrowsÓï¾ä£¬Ê¹´úÂëÔÓÂÒÎÞÕ£»²¢ÇÒNestedRuntimeExceptionµÄ×ÓÀ࣬ÊÇ¿ÉÒÔͨ¹ýNestedRuntimeExceptionµÄgetCause£¨£©·½·¨»ñµÃµ¼Ö¸ÃÒì³£µÄÁíÒ»¸öÒì³£¡£

32

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ÔÚBaseDaoImpÖл¹ÊÇÓÃÁËFindByNamedParam·½·¨µÄÁíÒ»¸öÖØÔØ·½·¨£¬Õâ¸ö·½·¨Í¬ÑùÐèÒªÈý¸ö²ÎÊý²¢ÇÒ·µ»ØÒ»¸öListÊý¾Ý¼¯ºÏ£¬Í¬Ñù»áÅ׳öDataAccessExceptionÒì³££¬org.springframework.orm.hibernate3.HibernateTemplate.findByNamedParam(String queryString, String paramName, Object value) throws DataAccessExceptionÔÚÕâ¸ö·½·¨µÄÈý¸ö²ÎÊýÓëÇ°ÃæµÄÄǸö·½·¨µÄ²ÎÊýÓÐÒ»¶¨µÄÏàËÆ£¬µÚÒ»¸ö²ÎÊýͬÑùÊÇÒ»¸ö²éѯÓï¾ä£¬Óï¾äÖÐÐèÒª²éѯµÄ×Ö¶ÎͬÑù°´ÕÕparamName=:paramNameµÄ·½Ê½½øÐÐÉèÖ㬵ڶþ¸ö²ÎÊýÔòÊÇ×ֶεÄÃû³Æ£¬µÚÈý¸ö²ÎÊýÔòÊÇÒ»¸öObjectÀàÐ͵ÄValueÖµ¡£×îºó°´ÕÕÕýÈ·µÄ²éѯÓï¾äºÍ¶ÔÓ¦µÄÖµ£¬¾Í¿ÉÒÔ»ñÈ¡µ½ÏàÓ¦µÄÊý¾Ý¼¯ºÏ¡£

ÔÚBaseDaoImpÖÐÓÐÒ»¸öÊÇ·ÖÒ³²éѯµÄ·½·¨£¬Ôڸ÷½·¨ÖÐʹÓÃÁËHibernateTemplateµÄexecuteFind·½·¨£¬¸Ã·½·¨ÐèÒªHibernateCallback action×÷Ϊ²ÎÊý£¬×îºó·µ»ØÒ»¸öListÊý¾Ý¼¯ºÏ£¬HibernateCallbackÊÇÒ»¸ö»Øµ÷º¯Êý£¬ÔÚÕâ¸ö»Øµ÷º¯ÊýÖжÔÓÚ·ÖÒ³²éѯµÄ¾ßÌåʵÏÖÈçÏ£º

new HibernateCallback() {

public Object doInHibernate(Session session) throws HibernateException, SQLException {

}

ÈçÉÏ´úÂëËùʾ£¬ÔÚexecuteFindÖд´½¨ÁËÒ»¸öHibernateCallbackµÄʵÀý¶ÔÏó£¬ÔڸöÔÏóÖÐÖÐÓÐÒ»¸ödoInHibernateµÄ·½·¨£¬¸Ã·½·¨»á°ÑHibernateµÄSession´«ÈëÆäÖУ¬Í¨¹ýsession.createQuery(hql)»ñÈ¡µ½HibernateµÄQuery¶ÔÏó£¬Í¨¹ýÉèÖÃquery.setFirstResult(first); query.setMaxResults(max);À´ÊµÏÖ·ÖÒ³²éѯ£¬×îºóͨ¹ýList list = query.list();»ñÈ¡µ½ListÊý¾Ý¼¯ºÏ²¢½«Êý¾Ý¼¯ºÏ·µ»Ø£¬ÖÁ´Ëͨ¹ýHibernateTemplateºÜºÃµÄʵÏÖÁË·ÖÒ³²éѯ¡£

6.2 FreemarkerµÄÓ¦ÓÃ

FreeMarkerÊÇÒ»¸öÓÃJavaÓïÑÔ±àдµÄÄ£°åÒýÇ棬Ëü»ùÓÚÄ£°åÀ´Éú³ÉÎı¾Êä³ö¡£ÔÚ±¾ÏµÍ³Öл¹Êǽ϶àµÄʹÓÃÁËFreeMarkerµÄ¸÷ÖÖ±êÇ©[13]£¬ÏÂÃæ¶ÔÔÚÏîÄ¿ÖÐʹÓÃFreeMarker

33

}

Query query = session.createQuery(hql); query.setFirstResult(first); query.setMaxResults(max); List list = query.list(); return list;

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ÒÔ¼°ÏµÍ³ÖÐËùÉæ¼°µ½µÄ±êÇ©×ö¼òµ¥µÄ½éÉÜ£º

ҪʹÓÃFreeMarkerÐèÒª½«ÆäÕûºÏµ½ÏµÍ³µÄ¼Ü¹¹ÖУ¬±¾ÏµÍ³µÄºËÐļܹ¹ÎªSpringMvc£¬ÔÚSpringMvcµÄÅäÖÃÖÐͨ¹ýÈçÏÂÅäÖÃÀ´½«FreeMarkerÕûºÏµ½ÏµÍ³Öеģ¬´úÂëÈçÏ£º

class=\

¸Ã¶ÎÅäÖôúÂëÊÇÔÚSpringMvcµÄdispatcher-servlet.xmlÅäÖÃÎļþÖÐÅäÖõģ¬Õâ¶ÎÅäÖÃÖ÷ÒªÊÇÈ¥¼ÓÔØFreeMarkerµÄÅäÖÃÎļþfreemarker.properties£¬ÔÚÕâÎļþÖжÔFreemarkerµÄ×Ö·û¼¯µÈ½øÐÐÁËÉèÖá£

class=\

Õâ¶ÎÅäÖÃÊǶÔFreeMarkerµÄÄ£°åµÄ·¾¶½øÐÐÅäµÄ£¬Í¨¹ýÕâ¶ùµÄÅäÖÿÉÒÔ¿´³öËùÓеÄÄ£°å¶¼ÊÇ´æ·ÅÔÚhtmlĿ¼Ïµģ¬¼ò¶øÑÔÖ®¾ÍÊÇSpringMvcÔÚ·µ»ØÊÓͼµÄʱºò£¬»áÔÚhtmlĿ¼ÏÂÑ°ÕÒÏàÓ¦µÄÄ£°åÒ²¾ÍÊÇÒ³Ãæ¡£

class=\

value=\

34

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ÒÔÉÏ´úÂëÊǶÔFreeMarker½âÎöÆ÷µÄÅäÖã¬ÓÉÒÔÉÏÅäÖôúÂë¿ÉÖª½âÎöÆ÷É趨Ϊºó׺ÃûΪ.htmlµÄÎļþ¼´HtmlÎļþ£¬Í¬Ê±»¹ÉèÖÃÁ˱àÂ뼯µÈ¡£Í¨¹ýÕâÈý¸öÅäÖþͳɹ¦µÄ½«FreeMarkerÕûºÏµ½ÏµÍ³ÖÐÁË¡£

ÔÚÕû¸öϵͳÖÐʹÓÃÁ˼¸ÖÖ¼òµ¥µÄ±êÇ©À´»ñÈ¡ºÍ´¦Àí²¢ÏÔʾÊý¾Ý£¬×î³£ÓõÄÔòÊÇ${}£¬

ͨ¹ý${}¿ÉÒÔÖ±½Ó»ñÈ¡µ½SpringMvcÖеÄmodelÖеÄÊý¾Ý£¬Îª±ÜÃâÒòΪÊý¾ÝΪ¿Õ¶øµ¼Ö´íÎ󣬿ÉÒÔʹÓÃ${(value)!}£¬´ËÖÖ¸ñʽµÄ×÷ÓÃÊǵ±value²»Îª¿ÕµÄʱºòÏÔʾvalueÖµ£¬µ±valueΪ¿ÕʱÏÔʾ¡°£¡¡±ºóÃæµÄÄÚÈÝÕâÑù¾Í²»»áÒòΪÊý¾ÝΪ¿Õ¶ø²úÉú´íÎó¡£ÔÚϵͳÖÐʹÓý϶àµÄ±êÇ©»¹ÓÐ<#if>±êÇ©£¬¸Ã±êÇ©ÊÇÓÃÀ´×÷ΪÅжÏʹÓõģ¬¿ÉÒÔÔڸñêÇ©ÖÐʹÓø÷ÖÖÅжÏÌõ¼þ£¬±ÈÈç: <#if (totalPage > 0) >Õâ¾ä´úÂëµÄÒâ˼ÊÇÅжÏtotalPageÊÇ·ñ´óÓÚ0£¬<#if totalPage ??>Õâ¾ä´úÂëµÄÒâ˼ÊÇÅжÏtotalPageÊÇ·ñ´æÔÚ¡£ÁíÍâʹÓýÏΪ³£¼ûµÄ»¹ÓÐ<#list>±êÇ©£¬¸Ã±êǩʹÓÃÀ´´¦ÀíListÊý¾Ý¼¯ºÏµÄ£¬±ÈÈ磺<#list list as goodsInfo>Õâ¶Î´úÂëµÄ×÷ÓÃÊÇÑ­»·±éÀúlist¼¯ºÏ£¬Ã¿´ÎÑ­»·¶ÔÓ¦µÄÊý¾ÝÈ¡±ðÃûΪgoodsInfo£¬È»ºóͨ¹ýgoodsInfo¾Í¿ÉÒÔ»ñÈ¡µ½ÏàÓ¦µÄÊý¾Ý¡£

6.3 Ê÷Ðνṹ²å¼þJquery Ztree

¶ÔÓÚÉÌÆ·ÀàÐÍÕâÖÖÎÞÏÞ·ÖÀàµÄ±í½á¹¹µÄ´¦Àí£¬ÔÚ±¾ÏµÍ³ÖвÉÓõÄÊÇÊ÷ÐνṹÀ´Õ¹Ê¾£¬¶ÔÓÚÊ÷Ðνṹϵͳ²ÉÓÃÁËZtree¡£ZtreeÊÇJqueryµÄÒ»¸ö²å¼þ[14]£¬Õâ¸ö²å¼þÄ¿Ç°·¢Õ¹ºÜºÃµÃµ½Á˺ܺõķ¢Õ¹£¬ÊµÏÖÆðÀ´ÕûÌåЧ¹ûÒ²·Ç³£µÄ²»´í¡£

¶ÔÓÚZtreeµÄʹÓÃÊ×ÏÈÐèÒªÅãןÃÊ÷ÐνṹµÄ²ÎÊýÒ²¾ÍÊǶÔÏóÖеÄsetting£¬È»ºóͨ¹ýJqueryµÄAjax´Óºǫ́»ñÈ¡Êý¾Ý£¬×îºóͨ¹ý$(\data);³õʼ»¯Ê÷Ðνṹ£¬ÕâÑù»ù±¾µÄ½á¹¹¾Í½¨Á¢ÆðÀ´ÁË¡£ÔÚZtreeÖÐÓм¸¸ö±Ø¼Æ½ÏÖØÒªµÄÅäÖòÎÊý£¬ÏÂÃæ×ö¼òµ¥µÄ½éÉÜ¡£ZtreeÖеÄsettingÅäÖÃÊÇÕû¸öµÄºËÐÄÅäÖ㬶ÔÓÚÊ÷ÐνṹÊÇ·ñÕ¹¿ª¡¢ÒÔºÎÖÖÐÎʽչʾ¶¼¿ÉÒÔÔÚÕâ¸ösettingÖÐÅäÖ᣸ù¾ÝϵͳµÄ¹¦ÄÜÐèÇó£¬Õâ¶ùÐèÒªÌرð½éÉÜÒ»µã£¬ÔÚsettingÖÐÓÐÒ»¸öcallback£¬callbackÊÇÒ»¸ö»Øµ÷º¯Êý£¬Ôڸûص÷º¯Êýµ±ÖÐÓÐÒ»¸örightClick£¬ÕâÊÇÒ»¸öÓÒ¼üµ¥»÷ʼþ£¬ÔÚ¸ÃʼþÖÐÏÔʾÁËÓÒ¼ü²Ëµ¥¡£ÔÚÓÒ¼ü²Ëµ¥ÖÐÓÐÈý¸ö¹¦ÄÜ°´Å¥£¬·Ö±ðΪ£ºÐÂÔöÀàÐÍ¡¢ÐÞ¸ÄÀàÐÍ¡¢É¾³ýÀàÐÍ£¬ÔÚÏÔʾÓÒ¼ü²Ëµ¥Ç°»á¸ù¾Ýtree.pNode.idµÄÖµÀ´×öÅжϣ¬µ±¸ÃÖµÈç¹ûµÈÓÚ0Ôò±íʾÊǸù½Úµã£¬¸Ã½Úµã±íʾµÄÊÇÆ·ÅÆÐÅÏ¢£¬²»ÄܽøÐÐɾ³ýºÍÐ޸ĸã¬ËùÒÔͨ¹ýÈçÏ´úÂëtree.showItem([\À´Íê³ÉÊ÷ÐνṹµÄ´´½¨µÄ¡£ÔÚZtreeÖеÄÅäÖÃÖнÏΪÖØÒªµÄ»¹ÓÐinit£¬ÕâÊÇZtreeµÄ³õʼ»¯Ê¼þ£¬ÔÚ¸ÃʼþÖжÔZtreeµÄÓÒ¼ü²Ëµ¥µÄÈý¸ö¹¦ÄÜ×öÁËʼþ°ó¶¨¡£¶ÔÓÚÓÒ¼ü²Ëµ¥µÄÏÔʾºÍÒþ²ØÊÇͨ¹ýZtreeµÄshowRightMenuʼþÀ´´¦ÀíµÄ¡£ÔÚ¸ÃʼþÖлá×öÌõ¼þÅжϣ¬µ±

35

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© tree.pNode.idµÄÖµ´óÓÚ0ÊÂÔò±íʾÉÌÆ·ÀàÐÍÐÅÏ¢£¬ÉÌÆ·ÐÅÏ¢ÀàÐͱãÄܹ»ÓÐÌí¼Ó¡¢Ð޸ĺÍɾ³ýµÄ¹¦ÄÜ£¬ÔÚ³ÌÐòÖÐͨ¹ýÒÔÏ´úÂëÀ´ÏÔʾÈý¸ö¹¦ÄÜ°´Å¥´úÂëÈçÏ£ºtree.showItem([\\\¡£¶ÔÓÚÓÒ¼ü²Ëµ¥µÄÒþ²ØÊÇͨ¹ýhideItemÀ´ÅäÖõģ¬ÔÚ¸ÃÅäÖÃÖÐÉèÖÃÁËÓÒ¼ü²Ëµ¥µÄÒþ²Ø¡£

ÏÂÃæ¶Ô½ÚµãµÄÌí¼Ó¡¢Ð޸ġ¢É¾³ýµÄʵÏÖ×ö¼òµ¥½éÉÜ£º

addNodeÖÐʵÏÖµÄÊǽڵãµÄÌí¼Ó£¬Ê×ÏÈÊǵ÷ÓÃshowNode()·½·¨£¬Ôڸ÷½·¨Öд´½¨Ò»¸öµ¯³ö²ãÓÃÓÚÉèÖÃÀàÐ͵ÄÃû³Æ£¬È»ºóͨ¹ýAjax½«¸¸½ÚµãµÄIDºÍÀàÐÍÃû³ÆÌá½»¸øºǫ́£¬ºǫ́½«ÀàÐͱ£´æ¡£µ±AjaxÇëÇó³É¹¦¹ýºó½«µ¯³ö²ãµÄÊý¾ÝÇå¿Õ²¢Òþ²Øµ¯³ö²ã£¬È»ºó¾ÍÔÚÊ÷ÐνṹÖÐÌí¼ÓÒ»¸ö½Úµã£¬½ÚµãµÄÌí¼ÓÊÇͨ¹ýÈçÏ´úÂëÀ´ÊµÏÖµÄtree.zTree.addNodes(tree.pNode, [{ //Ìí¼Ó½Úµãid: goodsType.id, pId: tree.pNode.id, name: nodeName, isParent: false}]);¡£ZtreeÓÐÒ»¸öaddNodesµÄ·½·¨£¬ÔÚ´Ë´¦Ïò¸Ã·½·¨Öд«ÈëÁËÁ½¸ö²ÎÊýÒ»¸öÊǸ¸¼¶½Úµã£¬ÔÚ´Ë´¦Í¨¹ýtree.pNodeÀ´»ñÈ¡µÄ£¬ÁíÍâÒ»¸ö²ÎÊýÊÇoptionsÅäÖÃÐÅÏ¢£¬ÔÚÕâ¶ùÖ÷ÒªÉèÖÃÁËID¡¢PID¡¢NodeName¡¢IsParentÕ⼸¸ö²ÎÊý£¬ÕâÑù¾ÍÍê³ÉÁËеÄÉÌÆ·ÐÅÏ¢ÀàÐͺͽڵãµÄÌí¼Ó¡£

showNodeÖÐʵÏÖµÄÊǽڵãµÄ¸üУ¬Ôڸ÷½·¨ÖÐͬÑùÊ×Ïȵ÷ÓõÄÊÇshowNode()·½·¨£¬²¢ÇÒÏò¸Ã·½·¨Öд«ÈëÁ˽ڵãµÄÃû³Æ£¬ÔÚµ¯³ö²ãÖÐÓÃÓÚÏÔʾºÍÐ޸ģ¬½ÚµãµÄÃû³ÆÊÇͨ¹ýZtreeµÄtree.pNode.name»ñÈ¡µÃµ½µÄ¡£ÔÚµ¯³ö³ÉÖÐÐ޸ĺÃÒÔºóµã»÷È·¶¨£¬½«ÐµÄÀàÐÍÃû³ÆºÍÀàÐ͵ÄIDͨ¹ýJqueryµÄAjax´«Èëµ½ºǫ́½øÐÐÊý¾Ý¸üУ¬Êý¾Ý¸üгɹ¦¹ýºóÇå³ýµ¯³ö²ãÖеÄÊý¾Ý²¢½«µ¯³ö²ãÒþ²Ø£¬×îºó¸üÐÂÊ÷Ðνṹ¡£¶ÔÓÚÊ÷ÐνṹµÄÐ޸ģ¬Ê×ÏȶÔnameµÄÐÞ¸ÄÊÇͨ¹ýtree.pNode.name = newNameʵÏֵģ¬Òª¸üÐÂÒ³Ã滹ÐèÒªµ÷ÓÃZtreeµÄupdateNode·½·¨£¬ÈçÏ´úÂ룺tree.zTree.updateNode(tree.pNode, true)£¬Ôڸ÷½·¨ÖÐÐèÒªÁ½¸ö²ÎÊý£¬Ò»¸öÊǵ±Ç°µÄ½Úµã£¬µÚ¶þ¸öÊÇÒ»¸öBooleanÀàÐ͵ÄÖµ£¬Õâ¶ù´«Èëtrue£¬±íʾÁ¢¼´¸üУ¬ÕâÑù¾ÍʵÏÖÁËÒ»¸öÉÌÆ·ÀàÐ͵ĸüдÓÒ³ÃæµÄ¸üе½Êý¾Ý¿âµÄ¸üС£

deleteNodeÖÐʵÏÖµÄÊǽڵãµÄɾ³ý£¬Ôڸ÷½·¨ÖÐÊ×ÏÈͨ¹ýtree.pNode.isParentÅжϸýڵãÊÇ·ñΪ¸¸½Úµã£¬È»ºóͨ¹ýwindow.confirm×÷³ö²»Í¬µÄÌáʾÐÅÏ¢£¬Ìáʾ¹ÜÀíÔ±ÊÇ·ñ½øÐÐɾ³ý¡£µ±tree.pNode.isParentΪTrueʱɾ³ý¸Ã½Úµã°üÀ¨ÒÔϵĽڵ㣬·´ÕýÔòɾ³ý¸Ã½Úµã£¬¶ÔÓÚÊý¾Ý¿âÖеÄÊý¾ÝÊÇͨ¹ýJqueryµÄAjaxÀ´ÊµÏÖɾ³ýµÄ¡£×îºóµ÷ÓÃtree.zTree.removeNode(tree.pNode)ÖеÄremoveNode·½·¨²¢½«µ±Ç°½Úµã´«ÈëÆäÖнøÐнڵãµÄɾ³ý£¬×îºóµ÷ÓÃtree.zTree.refresh()£¬À´Ë¢ÐÂZtreeµÄÊ÷Ðνṹ£¬×Դ˽ڵãɾ³ýÍê³É¡£

36

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© 6.4 ÎļþÉÏ´«²å¼þUploadfly

UploadifyÊÇJQueryµÄÒ»¸öÉÏ´«²å¼þ£¬ÊµÏÖµÄЧ¹û·Ç³£²»´í£¬´ø½ø¶ÈÏÔʾ£¬²¢ÇÒÖ§³Ö´óÎļþµÄÉÏ´«£¬ÔÚ±¾ÏµÍ³Öиòå¼þÖ÷ÒªÓÃÓÚÉÌƷͼƬ¡¢¸÷ÖÖͼ±êµÄÉÏ´«¡£ÏÂÃæ´Ó¸Ã²å¼þµÄʹÓá¢ÅäÖõȼ¸·½Ãæ×öÏêϸµÄ½éÉÜ£º

Ê×ÏÈҪʹÓøòå¼þµÄ»°ÐèÒªÒýÈëÏà¹ØµÄJavascriptºÍCssÎļþ£¬ÐèÒªÒýÈëµÄJavascriptÎļþÓÐswfobject.js¡¢jquery.uploadify.js¡¢jQuery.js£¬CssÎļþÓÐuploadify.css£¬È»ºóÊǶԸòå¼þ½øÐÐÅäÖã¬ÅäÖÃÎļþÐèÒªÔÚ$(\ÖнøÐÐÉèÖã¬ÏÂÃæ¶Ô½ÏΪÖØÒªµÄ¼¸¸öÅäÖÃÏî½øÐнéÉÜ¡£

ÅäÖÃÏîAutoÊÇÅäÖÃÎļþÑ¡ÔñºóÊÇ·ñ×Ô¶¯ÉÏ´«£¬Èç¹ûÉèÖÃΪTrue£¬Ôò±íʾÁ¢¼´ÉÏ´«£¬ÉèÖÃΪFalse£¬±íʾ²»×Ô¶¯ÉÏ´«¡£MultiʹÓÃÓëÅäÖøòå¼þÊÇ·ñÖ§³Ö¶àÎļþÉÏ´«£¬ÉèÖÃΪTrue±íʾ֧³Ö¶àÎļþÉÏ´«£¬ÉèÖÃΪFalse±íʾµ¥ÎļþÉÏ´«¡£SwfΪ²å¼þ¼ÓÔصÄFlash²å¼þ£¬ÔÚÎļþÉÏ´«µÄ¹ý³ÌÖÐÐèҪʹÓõ½¡£queueIDΪ¸Ã²å¼þÉÏ´«ÎļþʱÇëÇóµÄ·¾¶¡£fileTypeExtsÉèÖõÄÊÇÔÊÐíÉÏ´«µÄÎļþµÄÀàÐÍ£¬ÔÚ´Ë´¦ÎªÉÏ´«µÄÎļþΪͼƬ£¬ËùÒÔÉèÖõÄÎļþÀàÐÍΪ£º'*.jpg;*.gif;*.jpeg;*.png;*.bmp;'¡£Ôڸòå¼þµÄÅäÖÃÏîÖÐÅäÖÃ×ÅÐí¶àµÄ´¥·¢Ê¼þ¡£ onUploadStartʼþ±íʾµÄÊÇÔÚÎļþ¿ªÊ¼ÉÏ´«µÄʱºò´¥·¢£¬ÔÚ¸ÃʼþÖÐͨ¹ýÈçϵĴúÂ룺$(\: file.name,})½«ÎļþµÄÃû³ÆÌá½»¸øºǫ́£¬ÆäÖÐÎļþÃû³ÆÊÇͨ¹ýfile.nameÀ´»ñÈ¡µÄ¡£onUploadSuccessʼþÊÇÔÚÎļþÉÏ´«³É¹¦µÄʱºò´¥·¢£¬ÔÚ¸ÃʼþÖпÉÒÔ½øÐÐһЩ²Ù×÷£¬ÔÚ±¾ÏµÍ³ÖÐÖ÷ÒªÊǶÔͼƬµÄ´¦Àí£¬Í¨¹ýÈçÏ´úÂëÐÞ¸ÄImgµÄSrc $(\¡£ÖÁ´ËÒѾ­¶Ô¸Ã²å¼þ×öÁË´óÌåµÄ½éÉÜ£¬¶ÔÓÚ¼òµ¥µÄʼþºÍÅäÖÃÏî±ã²»ÔÙ×ö½éÉÜ¡£

6.5 Ajax·ÖÒ³

ÔÚ±¾ÏµÍ³ÖÐÓÐÁ½ÖÖ·ÖÒ³µÄ·½Ê½Ò»ÖÖÊǺǫ́¹ÜÀíÖеÄÐÅÏ¢ÁбíÖеķÖÒ³£¬ÕâÒ²Êdz£¹æµÄ·ÖÒ³£¬ÊÇͨ¹ý²éѯ½áºÏPagerÕâ¸öJavaBeanÀ´ÊµÏֵģ¬ÔÚ´Ë´¦²»×öÏêϸ½éÉÜ¡£ÁíÍâÒ»ÖÖ·ÖÒ³·½Ê½ÔòÊÇͨ¹ýJqueryµÄAjaxʵÏֵķÖÒ³£¬ÕâÊÇÔÚÉÌƷչʾÖвÉÓõķÖÒ³£¬ÕâÖÖ·½Ê½µÄºÃ´¦ÊÇÄܹ»Òì²½¼ÓÔØÊý¾Ý£¬Ò³ÃæʵÏÖ¾Ö²¿Ë¢Ð¡£ÏÂÃæ¶ÔJqueryµÄAjaxµÄ·ÖÒ³×öÏêϸµÄ½éÉÜ£º

ҪʹÓÃJqueryµÄAjax·ÖÒ³ÐèÒªÒýÈëÒ»¸öJavascript²å¼þ£¬²¢ÇÒÉèÖÃÏàÓ¦µÄCSSÑùʽ»¹ÐèÒªÔÚÒ³ÃæÖÐÉèÖÃ

37

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© pageNav.go()·½·¨£¬²¢ÇÒ½«µã»÷µÄÒ³Ãæ´«Èëµ½Õâ¸ö·½·¨ÖУ¬¶ÔÓÚ·ÖÒ³¹ýºó»¹ÓÐÏàÓ¦²Ù×÷µÄÔòÐèҪȥÖØдpageNav.go()·½·¨£¬ÔÚ±¾ÏµÍ³ÖжÔÓڸ÷½·¨µÄÖØдÖ÷ÒªÌåÏÖÔÚJquery¶ÔDOMµÄ²Ù×÷ÉÏ¡£Ôڸ÷½·¨µÄÖØдÖдúÂë½Ï¶à£¬²»±ãÓÚÕ³Ìù³öÀ´£¬¸Ã·½·¨ÖеĴðÌâÁ÷³ÌÊÇÊ×ÏÈͨ¹ýAjaxÇëÇóÊý¾Ý£¬È»ºó½«Êý¾Ý½âÎöͨ¹ýJquery²Ù×÷½«Êý¾Ýչʾµ½Ò³ÃæÉÏ¡£

ÔÚ·ÖÒ³²éѯµÄ·þÎñÆ÷¶ËµÄ´¦ÀíÒ²ÊǷdz£µÄ¼òµ¥µÄ£¬Ïëͨ¹ý²éѯÌõ¼þÉú³ÉÏàÓ¦µÄ²éѯÓï¾ä£¬Èúóͨ¹ýÈçÏ´úÂëʵÏÖ·ÖÒ³²éѯ£¬´úÂëÈçÏ£º

Query query = session.createQuery(hql) £» query.setFirstResult((pageNumber-1)*20); query.setMaxResults(20);

ÈçÉÏ´úÂ룬ͨ¹ýHibernate SessionµÄcreateQuery[15]·½·¨»ñÈ¡µ½HibernateµÄQuery¶ÔÏ󣬸öÔÏóÓÐÁ½¸ö·½·¨ÊÇÓÃÓÚ´¦Àí·ÖÒ³µÄ£¬Ò»¸öÊÇsetFirstResult£¬ÐèÒª´«ÈëÒ»¸öIntÀàÐ͵IJÎÊý£¬±íʾ²éѯµÄÆðʼҳ£¬ÁíÍâÒ»¸ö·½·¨ÊÇsetMaxResults£¬Ò²ÐèÒªÒ»¸öIntÀàÐ͵IJÎÊý£¬¸Ã·½·¨±íʾµÄÊÇ×î´óµÄ·µ»Ø½á¹¹Êý£¬Ò²¾ÍÊÇÿҳµÄ²éѯÊýÁ¿¡£×îºóͨ¹ýQuery¶ÔÏó»ñÈ¡µ½Êý¾Ý¼¯ºÏ·µ»Ø¸øÒ³Ã棬ÕâÑù¾ÍʵÏÖÁË·ÖÒ³µÄ²éѯ¡£

38

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© 7 ϵͳ²âÊÔ

7.1 ¹¦ÄܲâÊÔ

¶ÔÓÚ¹¦ÄܲâÊÔ±¾ÏµÍ³Ö÷ÒªÌåÏÖÔÚ²âÊÔÓÃÀýµÄ±àдÉÏ£¬²ÉÓõÄÊÇJUnit4½øÐвâÊԵġ£ÔÚ±¾ÏµÍ³ÖÐÊ×ÏȽ¨Á¢ÁËÒ»¸öBaseTestCaseµÄ»ùÀ࣬»ùÀà´úÂëÈçÏ£º @RunWith(SpringJUnit4ClassRunner.class)

@ContextConfiguration(locations={\public class BaseTestCase {}

ÈçÉÏ´úÂëËùʾ£¬Ê×ÏÈͨ¹ý@RunWithÉèÖòâÊÔÓÉSpringJUnit4ClassRunner½øÐвÙ×÷¹ÜÀí£¬SpringJUnit4ClassRunnerÊǶÔJUnit4µÄ½øÒ»²½·â×°¡£È»ºóͨ¹ý@ContextConfiguration×¢½âÉèÖÃlocationsΪclasspath:beans.xml£¬Õâ¾ä×¢½âµÄÒâ˼ÊǼÓÔØSpringµÄÅäÖÃÎļþ£¬ÕâÑù²âÊԵĻùÀà¾Í½¨Á¢ºÃÁË¡£

¶ÔÓÚÆäËüµÄ²âÊÔÓÃÀý¶¼ÊǼ̳гÉBaseTestCaseÕâÒ»¸ö»ùÀ࣬ÔÚ²âÊÔÓÃÀýÉÏͬÑùÐèÒªÌí¼Ó

@RunWith(SpringJUnit4ClassRunner.class)×¢½â¡£ÏÂÃæÓÃÒ»¸ö²âÊÔ·½·¨À´½²½â²âÊԵĹý³Ì£¬¸Ã

·½·¨ÈçÏÂ: @Test

public void getAll(){

List members = memberService.getAll(); for(Member member:members){ }

member.setPassword(DigestUtils.md5Hex(\memberService.update(member);

ÈçÉÏ´úÂëËùʾ£¬ÐèÒªÔÚ·½·¨ÉÏÌí¼Ó@Test×¢½â¾ÍÐÐÁË£¬È»ºóÔÚÕû¸ö·½·¨ÌåÖÐ×ö²âÊԵIJÙ×÷£¬¶ÔÓڸòâÊÔ·½·¨¿ÉÒÔͨ¹ýRun Test½øÐвâÊÔ£¬Junit½øÐлá¸ù¾Ý²âÊÔµÄÇé¿ö¸ø³ö²âÊÔ½á¹û¡£

7.2 ÐÔÄܲâÊÔ

ͨ¹ý¼òµ¥µÄ²âÊÔ¿É֪ϵͳµÄÐÔÄÜÁ¼ºÃ£¬¸÷¸öÒ³Ãæ¼äµÄÌøת·´Ó¦Ñ¸ËÙ£¬¶ÔÓÚÊý¾ÝµÄ´æÈ¡ºÍ½âÎöЧÂÊÒ²·Ç³£µÄ¸ã£¬Í¬Ê±JqueryµÄAjax»ñÈ¡Êý¾ÝЧ¹ûÒ²²»´í£¬ÕûÌåÒ³ÃæÁ÷³Ì£¬Êý¾Ý½»»»ºÅ¡£

39

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© 8 ϵͳ²¿Êð

±¾ÏµÍ³µÄ¿ª·¢ÊDzÉÓõÄMyEclipse·¢¿ª¹¤¾ß£¬·þÎñÆ÷²ÉÓõÄÊÇTomcat£¬ÕâÁ½ÖÖ¹¤¾ßÔÚWindowsÏÂÃ涼ʮ·ÖµÄÈÝÒײÙ×÷¡£ÔÚ³ÌÐòµÄ¿ª·¢µÄ¹ý³ÌÖÐÐèÒªÔÚ±¾µØ½¨Á¢Tomcat·þÎñÆ÷£¬È»ºóͨ¹ýMyeclipse½¨Á¢ÆðÓëTomcatÖ®¼äµÄÁªÏµ£¬ÔÚMyeclipseÖпÉÒÔͨ¹ýRun On Service½«ÏîÄ¿·¢²¼µ½TomcatÖв¢Æô¶¯Tomcat·þÎñÆ÷¡£ÔÚMyEclipseÖл¹ÓÐÒ»ÖÖ·½·¨¿ÉÒÔ½«ÏîÄ¿Ìí¼Óµ½·þÎñÆ÷ÖУ¬¸Ã·½·¨ÊÇÔÚTomcat·þÎñÆ÷ÉÏÓÒ¼ü½«ÏîÄ¿Ìí¼Óµ½TomcatÖУ¬È»ºóÖØÆô·þÎñÆ÷¼´¿É¡£

¶ÔÓÚ½«ÏîÄ¿·¢²¼µ½·þÎñÆ÷Öеķ½·¨Ò²·Ç³£µÄ¼òµ¥£¬¶ÔÓÚJava´úÂë¶øÑÔÖ»ÐèÒªÏò·þÎñÆ÷¸üбàÒëºóµÄClassÎļþ¼´¿É£¬¾ÍÊǽ«classesÎļþ¼ÐϵÄÎļþ¸üе½·þÎñÆ÷ÏàÓ¦µÄĿ¼Ï¼´¿É¡£¶ÔÓÚÆäËüµÄ×ÊÔ´ÎļþÖ±½Ó½«ÆäÏò·þÎñÆ÷¸üм´¿É¡£

40

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ½á ÂÛ

±¾ÆªÂÛÎÄÖ÷Òª½éÉÜÁË»ùÓÚSpringMvcµÄ¹ºÎïƽ̨µÄÉè¼ÆÓëʵÏÖ£¬ÔÚÂÛÎÄÖ÷Òª´ÓÐèÇó·ÖÎö¡¢Ïà¹Ø¼¼Êõ¡¢Êý¾Ý¿â·ÖÎöÓëÉè¼Æ¡¢¸ÅÒªÉè¼Æ¡¢ÏêϸÉè¼Æ¡¢ÖØÄѵã·ÖÎö¡¢ÏµÍ³²âÊÔ¡¢ÏîÄ¿²¿ÊðµÈ¼¸¸ö·½ÃæÏêϸµÄ½éÉÜÁ˸ÃϵͳµÄÉè¼ÆÓëʵÏÖ¡£

ÔÚÐèÇó·ÖÎöÖжÔϵͳµÄһЩ¹¦ÄÜÄ£¿é×öÁ˼òµ¥µÄ½éÉÜ£¬·Ö±ð³åÉÌÆ·µÄä¯ÀÀ¡¢ÉÌÆ·µÄÑ¡¹º¡¢µÇ¼¡¢×¢²á¡¢¸öÈËÖÐÐÄ¡¢ºǫ́¹ÜÀíµÈ¼¸¸öÄ£¿éÏêϸµÄ½éÉÜÁËϵͳµÄÐèÇó¡£ÔÚÐèÇó·ÖÎöÖжÔϵͳµÄ¿ÉÐÐÐÔ´Ó¾­¼Ã¿ÉÐÐÐÔ¡¢¼¼Êõ¿ÉÐÐÐÔ¡¢²Ù×÷¿ÉÐÐÐÔ¡¢·¨ÂÉ¿ÉÐÐÐԵȼ¸·½ÃæÏêϸµÄ·ÖÎöÁËϵͳ£¬×îºó²ÅÈ·¶¨ÏµÍ³ÊÇ¿ÉÐеġ£ÔÚÏà¹Ø¼¼ÊõµÄ½éÉÜÖУ¬±¾ÎĶÔʹÓõ½µÄ¼¼ÊõÒ»¸ö¹¤¾ß¶¼¼òµ¥µÄÓÐËù½éÉܺͷÖÎö¡£ÔÚʹÓõļ¼ÊõÖÐÏêϸµÄ½éÉÜÁËSpring¡¢SpringMvc¡¢Hibernate¡¢Javascript¡¢Jquery¡¢FreemarkerµÈ£¬ÕâЩ¼¼ÊõÖмÈÓд¦Àí·þÎñÆ÷µÄSpringºÍHibernateÒ²Óд¦ÀíÒ³ÃæЧ¹ûµÄJavascript¡¢CSS¡£¶ÔÓÚ¿ª·¢¹¤¾ßµÄ½éÉܾÍÖ÷Òª½éÉÜÁËMyeclipse¿ª·¢¹¤¾ß£¬MyEclipseÊDZ¾ÏµÍ³ËùÓдúÂëµÄ±à¼­Æ÷£¬ÔÚ¹¤¾ßµÄ½éÉÜÖÐͬÑù¶ÔÊý¾Ý¿âMysql¡¢·þÎñÆ÷Tomcat×öÁËÏêϸµÄ½éÉÜ¡£ÔÚÊý¾ÝÉè¼ÆÖдÓÊý¾Ý¿âµÄÉè¼ÆÔ­Ôò¡¢Êý¾Ý¿âµÄ½á¹¹Éè¼Æ¡¢ER¹ØϵͼÈý·½ÃæÏêϸµÄ½éÉÜÁËÊý¾Ý¿âµÄ·ÖÎöÓëÉè¼Æ¡£ÔÚϵͳµÄ¸ÅÒªÉè¼ÆÖÐÊÇͨ¹ýϵͳ¹¦ÄÜÄ£¿éÓëϵͳ¹¦ÄÜÁ÷³ÌÕâÁ½·½ÃæÀ´Ïêϸ½éÉܵġ£ÔÚÏêϸÉè¼ÆÖÐÊÇͨ¹ý¶Ô¹«¹²Ä£¿éµÄÉè¼ÆÓëʵÏÖºÍϵͳģ¿éµÄʵÏÖÕâÁ½´ó·½ÃæÀ´½éÉܵġ£ÔÚÖØÄѵãÖзÖÎöÖÐ×ܹ²·ÖÎöÁË5¸ö²¿·Ö£¬ÕâÎ岿·Ö°üº¬ÁËJava·þÎñÆ÷¿ª·¢¡¢Ò³Ãæ±êÇ©µÄʹÓᢲå¼þµÄʹÓá¢JavascriptµÄÔËÓõȶ෽Ãæ¡£×îºóʶÔϵͳµÄ²âÊԺͲ¿ÊðµÄ¼òµ¥µÄ½éÉÜ¡£

ÔÚÕû¸öϵͳµÄÉè¼ÆÓëʵÏֵĹý³ÌÖÐËäÈ»Óöµ½²»ÉÙµÄÎÊÌ⣬µ«ÊÇ×îÖÕ¶¼ºÜºÃµÄÍê³ÉÁ˱¾ÏµÍ³µÄÉè¼ÆÓëʵÏÖ£¬²¢ÇÒÈ¡µÃÁËÒ»¶¨µÄЧ¹û¡£µ±È»ÏµÍ³ÔÚÉè¼Æ·½Ã滹´æÔÚÐí¶àµÄ²»×ãµÄ·½ÃæÐèÒª¸Ä½ø£¬Í¬Ê±³ÌÐòÒ²ÓÐÒ»¶¨Á¿µÄBug£¬ÕâЩ¶¼»¹ÐèÒªÐÞ¸ÄÓëÍêÉÆ

41

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ²Î¿¼ÎÄÏ×

[1] Õź£·ª£®Èí¼þ¹¤³Ìµ¼ÂÛ[M].±±¾©£ºÇ廪´óѧ³ö°æÉ磬2003

[2] ³ÌÏÔÉú,¹ùÑÞ¹â.»ùÓÚSpringºÍHibernateÊý¾Ý·ÃÎʼ¼ÊõÑо¿ÓëÓ¦ÓÃ[J].ÖÆÔìÒµ×Ô¶¯

»¯,2011,33(5):152-154,178

[3] ³Â»Ô,ÕÔºéÉý,ÕÅÑÞ´ºµÈ.Struts+Spring+Hibernate¿ò¼ÜµÄÕûºÏʵÏÖ[J].ºÓÄÏ´óѧѧ±¨£¨×Ô

È»¿Æѧ°æ£©,2010,40(6):642-645

[4] ÀîÁÖ£¬Ê©Î°Î°£®JavaScript³ÌÐòÉè¼Æ½Ì³Ì[M]£®±±¾©£ºÈËÃñÓʵç³ö°æÉ磬2008 [5] ÖìÓ¡ºê£®Ï¬Àû¿ª·¢jQueryÄÚºËÏê½âÓëʵ¼ù[M]£®±±¾©£ºÇ廪´óѧ³ö°æÉ磬2010 [6] Ðì·æ£¬³ÂêÑ£®UMLÃæÏò¶ÔÏó½¨Ä£»ù´¡[M]£®±±¾©£ºÖйúË®ÀûË®µç³ö°æÉ磬2006 [7] ÖìÁú÷.dzÂÛÔÚÏß¹ºÎïϵͳµÄ·ÖÎöÓëÉè¼Æ[J].ÉÂÎ÷½ÌÓý£¨¸ß½Ì£©,2013,(7):116-117 [8] ϰʤ·á,Íô²ÄÁÖ.ÔÚÏß¹ºÎïϵͳµÄÉè¼ÆÓëʵÏÖ[J].ºþÄϳÇÊÐѧԺѧ±¨£¨×ÔÈ»¿Æѧ

°æ£©,2009,18(3):71-73

[9] »ÆÀò.»ùÓÚMVCµÄÔÚÏß¹ºÎïϵͳÉè¼ÆÓëʵÏÖ[J].¼ÆËã»ú¹âÅÌÈí¼þÓëÓ¦

ÓÃ,2010,(9):147,146

[10] Áõ࣬ÕÅÀû¹ú£®Hibernate¿ª·¢Óëʵս[M]£®±±¾©£ºµç×Ó¹¤Òµ³ö°æÉ磬2009 [11] Craig Walls, Ryan Breidenbach. Spring in Action[M]. Montana USA: Manning

Publications, 2007

[12] Mak G, Guruzu S. Hibernate Recipes[M]. California: Apress, 2010

[13] Brown S, Dalton S, Jepp D. Pro JSP 2[M]. Fourth Edition. California: Apress, 2005 [14] Bear Bibeault. Yehuda Katz. jQuery in Action[M]. Montana USA: Manning Publications,

2008

[15] Bloch J. Effective Java[M]. Second Edition. New Jersey -- NJ: Addison-Wesley, 2008

42

³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© Ö л

ÔÚ±ÏÒµÉè¼ÆÍê³ÉÖ®¼Ê£¬ÎÒÓÉÖԵĸÐлÎҵıÏÒµÉè¼Æµ¼Ê¦ÀîÁ¢ÀÏʦ£¬ÔÚ´ÓÈ·¶¨Ñ¡Ìâµ½Íê³É±ÏÒµÉè¼ÆµÄÕû¸ö¹ý³ÌÖУ¬ÀîÁ¢ÀÏʦ¶ÔÎÒÌṩÁËÐí¶àµÄ°ïÖú£¬¾­³£¶½´ÙÎҵıÏÒµÉè¼ÆºÍ±ÏÒµÂÛÎĵÄÍê³É½ø¶È¡£²¢ÇÒ¾­³£¶ÔÎÒ±ÏÒµÉè¼ÆÌá³ö±¦¹óµÄ½¨ÒéºÍÒâ¼û£¬Í¬Ê±¶ÔÓÚÎҵIJ»×ãÒ²Äܹ»¼°Ê±µÄ·¢ÏÖ²¢Ìá³öÀ´¡£ÀîÁ¢ÀÏʦÇڷܵŤ×÷×÷·ç¡¢ÑϽ÷µÄÖÎѧ̬¶È¡¢»ý¼«½øÈ¡µÄ¾«ÉñÃæò£¬¶¼½«³ÉΪÎÒ½ñºóÖÎѧ¡¢¹¤×÷ºÍ×öÈ˵İñÑù¡£ÁíÍ⣬ÎÒÔÚ³ÌÐòÉè¼Æ¹ý³ÌÖÐÓöµ½ÎÊÌâʱҲµÃµ½ÁËÆäËûͬѧµÄÈÈÇé°ïÖú£¬ËûÃÇÌá³öÁËÓÐÒæµÄ½¨ÒéºÍÒâ¼û¡£ÔÚ´ËÎÒ¶ÔËùÓаïÖú¹ýÎÒµÄÀÏʦºÍͬѧ±íʾÖÔÐĵĸÐлºÍÁ¼ºÃµÄ×£Ô¸£¡

ÔÚ´ËÎÒÒ²ÓÉÖԵĸÐл¹«Ë¾ÔÚÎÒ±ÏÒµÉè¼ÆÕâ¶Îʱ¼ä²¢Ã»ÓиøÎÒÌ«¶àµÄ¹¤×÷ѹÁ¦£¬Í¬Ê±¸Ðл¹«Ë¾µÄͬʶÔÎÒÈÈÐĵİïÖú¡£

43

ÁªÏµ¿Í·þ£º779662525#qq.com(#Ì滻Ϊ@)