ÕªÒª
±¾ÂÛÎĵÄÑо¿¿ÎÌâÊÇ¡¶»ùÓÚJSP¼¼ÊõµÄ¶©µ¥¹ÜÀíϵͳ¡·µÄʵÏÖ¡£±¾ÏµÍ³Í¨¹ý¶ÔÊý¾Ý¿âµÄÐÅÏ¢¼ìË÷¼°Î¬»¤¹¦ÄÜ£¬ÎªÓû§ºÍ¹ÜÀíÔ±ÌṩÍøÉÏÑ¡¹ºÍ¼ÊéºÍ¶©µ¥µÄÉú³É¡¢¹ÜÀí·þÎñ¡£Õû¸öÑо¿¹ý³Ì¾¹ýÐèÇó·ÖÎö¡¢ÏµÍ³Éè¼Æ¡¢ÏµÍ³¿ª·¢ºÍ²âÊÔËĸö½×¶ÎµÄ¹¤×÷¡£
±¾ÏµÍ³ÊÇ»ùÓÚInternet£¬²ÉÓÃä¯ÀÀÆ÷£¯·þÎñÆ÷µÄÈý²ã´Î½á¹¹£¬ÏµÍ³µÄ·þÎñÆ÷¶Ë£¨Server£©ÓÉServletsºÍJavaBeanʵÏÖ£¬¸ºÔð¿Í»§¶Ëä¯ÀÀÆ÷£¨Browser£©ÓëWeb·þÎñÆ÷£¨Web Server£©¼äµÄͨÐÅ£¬²¢ÒÔJDBCÊý¾ÝÁ¬½ÓΪ»ù´¡ÊµÏÖÁËWeb·þÎñÆ÷£¨Web Server£©ÓëÊý¾Ý¿â£¨Microsoft Access XP£©Ö®¼äµÄÊý¾Ý½»»»¡£ÏµÍ³Ê¹ÓÃjdk1.4.0×÷ΪJava»·¾³£¬Tomcat4.0·þÎñÆ÷×÷ΪJSPµÄÖ§³Öƽ̨¡£
ϵͳÓÉËĸö¹¦ÄÜÄ£¿é×é³É£º
×¢²áµÇ½ģ¿é£ºÓû§¡¢¹ÜÀíÔ±×¢²á¡¢µÇ½£¬²¢ÐÞ¸Ä×¢²áÐÅÏ¢
ͼÊé²éѯģ¿é£ºÓû§¿Éͨ¹ýÉèÖò»Í¬µÄËÑË÷·¶Î§ºÍ¹Ø¼ü×ÖÀ´²éѯͼÊ飬Ҳ¿ÉÒÔͨ¹ý·ÖÀà²é¿´À´²é¿´Ò»ÀàͼÊé
ͼÊéÑ¡¹ºÄ£¿é£ºÓû§¶Ô¹ºÎï³µÖеÄͼÊé½øÐÐÌí¼Ó¡¢É¾³ý¡¢ÐÞ¸ÄÊýÁ¿£¬²¢¶ÔÉú³É¶©µ¥£¬ÔÚ¶©µ¥±»ÉóºËÇ°£¬¿ÉÐ޸Ķ©µ¥ÄÚÈÝ
ϵͳ¹ÜÀíÄ£¿é£º¹ÜÀíÔ±²é¿´¶©µ¥ºÍÆäÏêϸÐÅÏ¢µÄ£¬²¢Í¨¹ýÉóºË¶©µ¥À´Ð޸Ķ©µ¥×´Ì¬£¬ÉóºËºóµÄ¶©µ¥Óû§²»ÄÜÐ޸ģ»¹ÜÀíÔ±Ò²ÔÚÕâ¸öÄ£¿éÖÐÌí¼ÓÐÞ¸ÄͼÊé¡¢·ÖÀà¡¢³ö°æÉçµÈÐÅÏ¢¡£
ϵͳʹÓÃÁËJSP+JavaBeanµÄ¿ª·¢Ä£Ê½£¬½«¶ÔÊý¾Ý¿â¡¢×Ö·û´®µÈ³£ÓòÙ×÷·â×°ÔÚJavaBeanÖУ¬Éè¼ÆÉÏʹÓÃÁËMVCģʽ£¨¼´Ä£ÐÍ¡¢ÊÓͼ¡¢¿ØÖÆ£©µÄ˼Ï룬ʵÏÖÂß¼ÓëÏÔʾµÄ·ÖÀ룬JSPÖ»¸ºÔðÒ³ÃæµÄÏÔʾ£¬¶øÒµÎñÂß¼µÈÓÉbeanÀ´ÊµÏÖ£¬Òþ²ØÁ˸´ÔÓµÄÊý¾Ý¿âµÈ³ÌÐòÂß¼²Ù×÷£¬¼õÉÙÔÚJSPÖнű¾´úÂëµÄʹÓã¬Ê¹µÃJSPÒ³¸ü¼ÓÒ×ÓÚά»¤£¬²¢Ìá¸ßÁËϵͳµÄ°²È«ÐÔ¡£
±¾ÏµÍ³Öصã²ûÊöÁ˶©µ¥¹ÜÀíϵͳÖС°¶©¡±ºÍ¡°¹Ü¡±µÄÎÊÌ⣬ÏêϸÉè¼ÆÁËϵͳÖеÄͼÊéÑ¡¹ºÄ£¿éºÍϵͳ¹ÜÀíÄ£¿é£¬½â¾öÁËÓû§Ñ¡¹ºÍ¼ÊéºÍ¹ÜÀíÔ±¶Ô¶©µ¥¹ÜÀíµÄÒµÎñÎÊÌ⣬´ïµ½ÁËϵͳÉè¼ÆµÄÔ¤ÆÚÄ¿±ê¡£
¹Ø¼ü×Ö£ºJDBC JavaBean MVC
Abstract
The research subject of the present paper is the implementation of the Order Management System based on JSP technology. The system provides the users and administrators with the service of book purchasing, order creation and management on the Internet by querying and maintaining of the database. The whole research process is divided into four stages, viz. analysis of demands, and the design, development and testing of the system.
This system is based on the Internet, adopting the three-hierarchy browser/server. The server is implemented by Servlet and JavaBean, being responsible for the communication between Browser and Web Server. The server also implements the data exchange between the Web Server and Access database through a JDBC bridge. The system uses jdk1.4.0 as its Java environment and Tomcat4.0 as its JSP platform.
System includes 4 function modules:
Register and login module: users and administrators register, login and modify their register information.
Book search module: users can search books by setting different ranges and keywords; they can also look over a series of books by the categorical search.
Book purchasing module: user can add, delete, modify the quality of books in the shopping vehicle and submit the orders. Before the orders are checked, the content of the orders can be modified.
System management module: administrators examine orders and their details, and modify the status of the orders by the function of order checking, but the users cannot modify the order after the examination; in this module administrators can also add or modify the information of books, such as their categories and publishers.
System uses a pattern of ¡°JSP+JavaBean¡±; it encapsulates the operations of database and string in a JavaBean. The design of the system is based on the thought of MVC (Model / View / Control) pattern, which implements the separation of logic and view. JSP is responsible for the view of the page, while the business logic is implemented by Beans, the complicated operations of program logic such as database are hidden, and the exploitation of scriplet is reduced, thus the maintaining of the JSP pages becomes easier, and the security of the system is strengthened.
The present system is proper to set forth the problem of ¡°Order and Management¡± in the Order management system. In the system, the book purchasing module and system management module are particularly designed. The business problem, therefore, of users¡¯ purchasing of books and administrators¡¯ managing of orders is solved, thus the expected aim of the system design is accomplished.
ÂÛÎÄÌâÄ¿£º»ùÓÚJSP¼¼ÊõµÄ¶©µ¥¹ÜÀíϵͳ
Ŀ¼
ÕªÒª I
Abstract II
Ŀ¼ IV
Ç°ÑÔ VII
µÚÒ»²¿·Ö Ð÷ÂÛ 1
1.1ÎÊÌâµÄÌá³ö 1
1.2¿ÎÌâµÄ±³¾°ºÍÒâÒå 1
1.2.1ʲôÊǵç×ÓÉÌÎñ 1
1.2.2µç×ÓÉÌÎñÓÐÄÄЩÌØÐÔ 2
1.2.3µç×ÓÉÌÎñ¶ÔÉç»á¾¼Ã»á²úÉúÄÄЩӰÏì 2
1.3ϵͳƽ̨ 4
µÚ¶þ²¿·Ö Ïà¹Ø¼¼Êõ½éÉÜ 5
2.1 JSP¼¼Êõ¼ò½é 5
2.1.1 JSP¹¤×÷ÔÀí 5
2.1.2 JSPµÄÓŵã 6
2.1.3 JSPµÄÉè¼ÆÄ¿±ê¼°ÆäʵÏÖ 6
2.2 Servlet¼¼Êõ 7
2.2.1 Servlet ¼¼Êõ¸ÅÊö 7
2.2.2 Servlet Óë JSP Ö®¼äµÄ¹Øϵ 8
2.3 JDBC¼¼Êõ¸ÅÂÛ 9
2.3.1 JDBCµÄÈÎÎñ 9
2.3.2 JDBCÁ½²ãÄ£ÐͺÍÈý²ãÄ£ÐÍ 10
2.4 C/S½á¹¹¼°B/W/SÈý²ã½á¹¹ 10
2.4.1 C/S½á¹¹ 10
2.4.2 B/W/SÈý²ã½á¹¹ 11
µÚÈý²¿·Ö ÐèÇó·ÖÎö 12
3.1ÒýÑÔ 12
3.1.1±àдĿµÄ 12
3.1.2±³¾° 12
3.1.3²Î¿¼×ÊÁÏ 12
3.2ÈÎÎñ¸ÅÊö 12
3.2.1Ä¿±ê 12
3.2.2Óû§µÄÌصã 13
3.2.3¼Ù¶¨ºÍÔ¼Êø 13
3.3ÐèÇó¹æ¶¨ 13
3.3.1¶Ô¹¦ÄܵĹ涨 13
3.4ÔËÐл·¾³¹æ¶¨ 13
3.4.1É豸 13
3.4.2Ö§³ÖÈí¼þ 14
3.4.3½Ó¿Ú 14
µÚËIJ¿·Ö ϵͳ¸ÅÒªÉè¼Æ 16
4.1ϵͳ¹¦ÄÜÄ£¿é»®·Ö 16
4.2Êý¾Ý¿âÉè¼Æ 17
4.2.1¸ÅÄîÄ£ÐÍÉè¼Æ 17
4.2.2Êý¾ÝÄ£ÐÍ 19
4.3Êý¾ÝÁ÷³Ì 20
4.4Êý¾Ý×Öµä 22
4.4.1Êý¾ÝÁ÷ 22
4.4.2Êý¾Ý´¦Àí 23
µÚÎ岿·Ö ϵͳÏêϸÉè¼ÆÓëʵÏÖ 26
5.1ϵͳ¿ª·¢»·¾³ 26
5.1.1 JSPÖ§³Öƽ̨Tomcat4.0 26
5.1.2ºǫ́Êý¾Ý¿âMicrosoft Access XP 28
5.2 JavaBeanµÄʹÓà 28
5.2.1 ·â×°Êý¾Ý¿â²Ù×÷µÄBean 28
5.2.2 ·â×°×Ö·û´®±àÂëת»»µÄBean 32
5.2.3 ·â×°ÈÕÆÚÐͱäÁ¿¸ñʽ»¯µÄBean 32
5.3 ϵͳÖкËÐÄ´úÂëµÄʵÏÖ 33
5.3.1¹ºÎï³µµÄʵÏÖ 33
5.3.2·ÖÒ³ÏÔʾµÄʵÏÖ 41
5.4ϵͳ¹¦ÄÜÄ£¿éµÄʵÏÖ 44
5.4.1Óû§µÇ¼/×¢²áÄ£¿é 44
5.4.2²éѯ¹¦ÄÜÄ£¿é 53
5.4.3ͼÊéÑ¡¹ºÄ£¿é 57
5.4.4 ϵͳ¹ÜÀíÄ£¿é 61
µÚÁù²¿·Ö Ñо¿³É¹ûÓëÇ°¾°Õ¹Íû 67
6.1Ñо¿³É¹û¸ÅÊö 67
6.2Èí¼þ²âÊÔ 67
6.2.1²âÊԼƻ® 67
6.2.2Ä£¿é²âÊÔ 68
6.2.3²âÊÔ½á¹û 70
6.3×ܽáÓëÕ¹Íû 70
²Î¿¼ÎÄÏ× 72
ÖÂл 73
¸½Â¼A Èí¼þʹÓÃ˵Ã÷ 74
Ô´Îļþ 74
ϵͳ°²×°ÓëÅäÖà 74
¸½Â¼B ¹Ø¼ü´úÂë 75
Ç°ÑÔ
±¾ÂÛÎĵÄÌâÄ¿ÊÇ¡¶ÍøÉϹºÊéϵͳ¡·¡£´ÓÀ´Ã»ÓÐÈκÎÊÂÎïÏñ»¥ÁªÍøÄÇÑù£¬¶ÔÈËÀàµÄ»î¶¯²úÉúÈç´ËÉî¿ÌµÄÓ°Ï죬ÎÞÂÛÊÇÕþ¸®¡¢ÆóÒµ£¬ÒÔ¼°¸öÈË£¬Äª²»Èç´Ë¡£Óë´Ëͬʱ£¬IT¹¤ÒµÒ²ÕýÃæÁÙ×ÅÒ»³¡±ä¸ï¡ª¡ª´«Í³Ó¦ÓÃÏò»ùÓÚInternet£¯WebµÄ·þÎñģʽת»¯¡£
·¿ªÀúÊ·£¬ÎÒÃÇ¿ÉÒÔ¿´µ½»¥ÁªÍøµÄÐγɺͷ¢Õ¹¾ÍÊÇÒÔ·Ö²¼ÐÔ¡¢¿ª·ÅÐÔºÍƽ̨ÎÞ¹ØÐÔΪ»ù´¡µÄ£¬ÕâÊÇInternetÓëÉú¾ãÀ´µÄÊôÐÔ¡£Ëæ×Å»¥ÁªÍøÓ¦Óõķ¢Õ¹£¬ÓÖÒýÈëÁËÖîÈçRPC£¯COM£¯CORBAµÈ¼¼Êõ£¬µ«ÕâЩ¼¼ÊõÔÚʵ¼ÊÓ¦ÓÃÖÐÓÖ´æÔÚןܶ಻×ãºÍ¾ÖÏÞ¡£ËûÃǵÄÌض¨ÐÒéÒ²ÄÑÒÔͨ¹ý·À»ðǽ£¬Òò¶ø²»ÊÊÓÚWebÉϵÄÓ¦Óÿª·¢¡£ÎªÁ˽øÒ»²½¿ª·¢»ùÓÚWebµÄÓ¦Óã¬Ïà¼Ì³öÏÖÁËSun¹«Ë¾µÄSun ONE£¨Open Net Environment¿ª·ÅÍøÂç»·¾³£©ºÍMicrosoft¹«Ë¾µÄ.NETÁ½´óWeb·þÎñ¼¼ÊõÌåϵ¡£ÆäÖУ¬Sun ONEÒÔJava¼¼ÊõΪºËÐÄ£¬¸ü½Ó½ü»òÕßÂú×㻥ÁªÍøÔÚÖÇÄÜ»¯Web·þÎñÉ϶Էֲ¼ÐÔ¡¢¿ª·ÅÐÔºÍƽ̨ÎÞ¹ØÐÔÒªÇó£¬Í¬Ê±ÆäÔÚ½¡×³ÐÔ¡¢°²È«ÐÔ¡¢×é¼þ»¯µÈ·½ÃæÒ²¸üΪ³ÉÊìÎȶ¨£¬»ñµÃÁËÖÚ¶àIT³§É̺ͲúÆ·µÄÖ§³Ö£¬ÊÇĿǰΨһÔÚÊг¡Éϵõ½Á˹㷺ӦÓõļ¼ÊõÌåϵ¡£