³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£©
»ùÓÚ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
µÚÒ»¸ö·½·¨ÐèÒªÁ½¸ö²ÎÊý£¬Ò»¸öÊÇ×Ö¶ÎÃû³ÆÁíÒ»¸öÊÇ×Ö¶ÎÃû³Æ¶ÔÓ¦µÄÖµ£¬Í¨¹ý¸Ãֵȥ²éѯÏàÓ¦µÄ×î½ü×îºó·µ»ØÒ»¸ölist¼¯ºÏ¡£µÚ¶þ¸ö·½·¨Í¬ÑùÊÇÐëÐèÒªÁ½¸ö²ÎÊý£¬µÚÒ»¸ö²ÎÊýÊÇStringÀàÐ͵ÄÊý×飬´æ·ÅµÄÊÇ×Ö¶ÎÃûÊý×é¡£¸Ã·½·¨µÄµÚ¶þ¸ö²ÎÊýÊÇObjectÀàÐ͵ÄÊý×飬´æ·ÅµÄÊǶÔÓ¦×ֶεÄÖµ¡£ÔÚ¾ßÌåµÄ·½·¨ÊµÏÖÖÐͨ¹ý¶ÔÊý×éµÄÑ»·Éú³É²éѯµÄhqlÓï¾ä£¬×îºó·½·¨·µ»ØÒ»¸ölist¼¯ºÏ¡£
£¨3£© ·ÖÒ³²éѯ·½·¨
public Pager findByPager(Pager pager,String hql);
¸Ã·½·¨ÊµÏÖÁË·ÖÒ³²éѯµÄ£¬Ö÷ÒªÓ¦ÓÃÓÚÇ°¶ÎÒ³ÃæÐèÒªÏÔʾÁбíµÄʱºòÊý¾Ý¹ý´ó½øÐÐ
18
³É¶¼Ñ§ÔºÑ§Ê¿Ñ§Î»ÂÛÎÄ£¨Éè¼Æ£© ·ÖÒ³²Ù×÷µÄ£¬Ã¿´ÎÖ»²éѯµ±Ç°Ò³µÄÊý¾Ý¡£¸Ã·½·¨ÐèÒªÁ½¸ö²ÎÊý£¬µÚÒ»¸öÊÇ·ÖÒ³»ùÀàPager£¬ÁíÍâÒ»¸öÔòÊDzéѯµÄhqlÓï¾ä¡£ÎªÁË×öµ½Áé»î¶à±äÒÔ¼°ÊµÏÖ¸÷ÖÖÌõ¼þµÄ²éѯ£¬Õâ¶ùµÄ²éѯÓï¾äÓõ÷Óõķ½·¨Ìṩ£¬¸ù¾Ý²»Í¬µÄÒµÎñÂß¼³ÌÐòÉè¼ÆÕß×Ô¼ºÊµÏÖ¡£
£¨4£© ΪÕë¶Ô·¢Õ¹µÄ²éѯÌõ¼þͬÑùµÄbasedaoÖÐÉùÃ÷ÁËÁ½¸ö·½·¨À´ÊµÏÖÕâÑùµÄ¹¦ÄÜ£¬Á½¸ö·½·¨¶¼Ö»ÐèÒª´«ÈëÒ»¸öhqlÓï¾ä£¬Í¨¹ý¾ßÌåµÄʵÏÖ£¬Á½¸ö·½·¨·Ö±ð·µ»ØÒ»ÌõÊý¾ÝºÍÒ»¸ölistÊý¾Ý¼¯ºÏ¡£·½·¨ÉùÃ÷ÈçÏ£º
public List
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+'