Design and implementation of shopping mall system based on Java web

Table of Contents
1 Introduction 1
1.1 Background and significance of this subject research 1
1.1.1 Background of this subject research 1
1.1.2 Significance of this subject research 2
1.1.3 Development status and prospects of this subject 2
1.2 System realization task 7
2 System Overview and implementation technology introduction 8
2.1 Online shopping mall introduction 8
2.2 Relevant implementation technology introduction 10
2.2.1 JSP language and its characteristics 10
2.2.2 DreamweaverMX knowledge introduction 12
2.2.3 Database basic knowledge introduction 13
2.2.4 JDBC basic knowledge introduction 15
2.3 Main architecture and development mode of the system16
2.3.1 B/S-based architecture16
2.3.2 MVC-based application development model17
3 System requirement analysis and feasibility analysis19
3.1 Requirement analysis19
3.1.1 Function overview19
3.2 Feasible Performance Analysis20
4 Overall Design22
4.1 Project Overall Design22
4.1.1 Design Ideas22 4.1.2
Overall Framework Design22
4.2 Database Design23
4.2.1 Database Design23
4.2.2 JSP Connection Database24
5 System Detailed Design and Implementation26
5.1 General framework of the front desk26
5.1.1 User management module26
5.1.2 Shopping cart module32
5.1.3 Message board module37
5.2 Background part39 5.2.1
General framework of the background39
5.2.2 Administrator login40
5.2.3 Commodity information management 41
5.2.4 User Information Management 44
5.2.5 Order Information Management 46
6 System Testing 48
6.1 Test Analysis of Key Parts of the System 48
6.1.1 Unit Test Analysis 48
6.1.2 Test Analysis Summary and Explanation 49
Conclusion 50
Acknowledgments 51
References 52

1 Introduction
1.1 Background and Significance of the Research
1.1.1 Background of the Research
In recent years, with the rapid rise of the Internet, the Internet has increasingly become the best channel for collecting and providing information and has gradually entered the traditional circulation field. As a result, e-commerce has become popular, and more and more merchants have set up online stores on the Internet, showing consumers a novel shopping concept.
Online shopping is a business information system with interactive functions. It provides users with static and dynamic information resources. The so-called static information refers to those resources that are more frequently changed or updated, such as company profiles, management norms, and company systems, etc.; dynamic information refers to information that changes at any time, such as commodity quotations, meeting arrangements, and training information. The online shopping system has a powerful interactive function, which enables merchants and users to transfer information conveniently and complete electronic trade or EDI transactions. This new transaction method realizes the paperless exchange of documents and funds between companies.
At present, PHP and ASP are the most widely used in China. And because JSP is a relatively new technology, it is rarely used in China. However, in foreign countries, JSP is already a relatively popular technology, especially for e-commerce websites, which mostly use JSP.
Websites using PHP such as Sina, Chinaren, etc., but due to some shortcomings of PHP itself, it is not suitable for large-scale e-commerce sites, but more suitable for some small commercial sites.
First, PHP lacks scale support. Second, there is a lack of multi-layer structure support. For sites with heavy loads, there is only one solution: distributed computing. The database, application logic layer, and presentation logic layer are separated from each other, and the same layer can also be separated according to traffic to form a two-dimensional array. PHP, on the other hand, lacks this support. As mentioned above, the database interface support provided by PHP is not uniform, which makes it not suitable for use in e-commerce.
ASP and JSP do not have the above defects. ASP can obtain ActiveX large-scale support through COM/DCOM of Microsoft Windowsd, and obtain structural support through DCOM and TranscationServer; JSP can obtain large-scale support through SUNJava's JavaClass and EJB, and through EJB/CORBA and ApplicationServer of many manufacturers. Get structural support.
Among the three, JSP should be the trend of future development. Some of the world's largest e-commerce solution providers use JSP/Servlet. Well-known such as IBM's E-business, its core is WebSphere using JSP/Servlet; another very famous e-commerce software provider in the West, Intershop. Its original product Intershop12,3,4 occupied the main e-commerce software share. They are all supported by CGI. But after October last year, it launched Enfinity, an e-commerce Application Server using JSP/Servlet, and claimed that it would no longer develop traditional software.
Generally speaking, ASP, PHP, and JSP all have a considerable number of supporters, and these three have their own strengths. During the development process, we should use the most appropriate technology according to actual needs. This system The newer JSP technology is used. On the one hand, the security and cross-platform of JSP are better.
1.1.2 Significance of this subject research
The development of the Internet provides a technically feasible solution for changing the traditional business operation mode: use Internet technology and protocols to establish various intranets and extranets of enterprises , Through cheap means of communication, buyers, sellers, manufacturers and partners are closely combined to eliminate obstacles caused by time and space, thereby greatly saving transaction costs and expanding the scope of transactions. In real life, this scheme has been widely used in actual business activities, and people call this transaction mode: e-commerce.
Today's more popular online shopping system is "Taobao (www.taobao.com)" in foreign countries, and "Dangdang (www.dangdang.com)" in China. They are all pretty good e-commerce sites and provide good examples for other sites. You can learn to refer to their ideas in the design, understand and be familiar with the development process of the entire website and the functions and precautions that a complete e-commerce website should have.
The design and completion of an e-commerce website will involve many technical issues, such as: dynamic webpage production technology, background database design and management, through the actual production of a website, you can avoid talking on paper and master the above in practice Use of Technology.
1.1.3 Development status and prospects of this topic

  1. E-Commerce Development Status
    The following is a further analysis of the current online shopping status according to the China Electronics Morning Development Report released by CNNIC (China Internet Network Information Center). (Mainly refer to the analysis chart in it)

Figure 1-1 Reasons for choosing online shopping
From the above figure, it can be seen that 46.7% and 44.2% choose online shopping to save time and operate conveniently, which shows that with the accelerated pace of life, people increasingly hope to have simple and fast way of shopping.

Figure 1-2 The way users choose product delivery
From the above figure, it can be seen that people always want to get the items directly without delaying their time. If it is home delivery, they can check the purchased items in person. This also shows people's concerns about the reputation of manufacturers.

1-3 What users think is the biggest problem in online transactions
It can be seen from the above figure that the two most serious problems are security and product services.
2) The prospect of e-commerce. 
E-commerce is still a new thing in our country. The emergence of e-commerce will challenge the knowledge system, legal system, value system, and social organization system that humans have formed so far. With the development of e-commerce technology, there will be many new knowledge systems, legal systems, value systems, and social organization system theories based on e-commerce systems. For example, economics under traditional economic conditions has a set of mature theories and calculation methods for the laws guiding economic activities such as resources, commodities, values, socially necessary labor time, and the laws of commodity exchange. These theories are no longer applicable in the network economy environment. We will not be able to use the traditional economic theory to reveal the economic law under the condition of e-commerce, instead we will have new economics under the condition of e-commerce. The development of e-commerce should be guided by new economic theories, and the development of e-commerce has promoted the emergence of new economic theories. It can be predicted that in the near future, a new set of e-commerce theoretical system will be established.
The laws that have been formed for a long time are based on paper media and tangible objects, and the application of these laws under the conditions of electronic commerce has encountered insurmountable difficulties. Most existing laws require "written", "signed" or "original" documents to have legal effect, which imposes or implies limitations on the use of modern means of communication. The laws and regulations on electronic information that have been promulgated internationally and domestically (for example, my country's new economic contract law, although it mentions that electronic data exchange documents have legal effect), do not involve all of e-commerce, making it difficult for people to accurately grasp The legal nature and validity of information provided in non-traditional written forms, nor the security of electronic payments can be fully trusted.
The unique mode of operation of e-commerce poses major challenges to the existing business norms in terms of technology, finance, and transaction security. Without legal norms, e-commerce will be difficult to develop normally. Timely formulation and promulgation of corresponding laws to encourage, guide and maintain the healthy development of e-commerce has become an important task of my country's current legislative work. The development of e-commerce poses a challenge to the traditional legal system. The development of e-commerce will promote the establishment of a new legal system, and the development of e-commerce depends on the regulation of the new legal system.
It is predicted that the new industrial revolution caused by e-commerce will be completed in the next 20-30 years. In this way, the e-commerce revolution takes 30-40 years from birth to completion, and the speed of completion is much faster than the previous industrial revolutions. When this industrial revolution is completed, the revolution of economic theory and legal theory will be completed at the same time, and a new theoretical system under e-commerce conditions such as e-commerce economics, e-commerce law, and e-commerce organization will be formed.
Technical development of e-commerceFrom
the technical development trend of e-commerce, there will be the following aspects:
(1) There will be an object-oriented overall solution. This includes widely adopting computer collaborative work technology, relying on collaborative operation system, etc. , taxation, banking, transportation, commodity inspection, customs, foreign exchange, insurance, telecommunications, certification and other departments, as well as shopping malls, merchants, corporate customers and other units cooperate with each other, connect with each other, and work together to complete relevant e-commerce according to certain norms and procedures. activities);
(2) will develop solutions for small and medium users (the current e-commerce platforms are mostly B2B e-commerce solutions, and there is no good e-commerce platform for small users); (3) will
appear Mobile embedded e-commerce technology that can be automatically generated. Using this technology, small embedded e-commerce systems can be automatically generated in the computer systems of various enterprises, departments and individuals;
(4) There will be a customizable flexible e-commerce system. Using this technology, the user can use the system to generate a scalable and flexible e-commerce system that meets the requirements of the e-commerce application.
At the same time, with the expansion of the scope of application, new technical requirements will be continuously put forward for e-commerce, and e-commerce technology may also have new developments that cannot be foreseen now. For example, the combination of e-commerce and new materials, and the combination of e-commerce and bioengineering technology will form new disciplines and new applications.
The application development of e-commerce
. The application of e-commerce has just started both in China and abroad. Even the United States, where it was first developed, has only a history of nearly ten years. Such a short period of time is relatively short even for the estimated shortest period of 30-40 years for the completion of this industrial revolution, and the application of e-commerce is far from being discovered. Because of its remarkable economic benefits, e-commerce must have broad prospects. It can increase the economic benefits of enterprises; it can make unknown small companies famous all over the world; it can make large companies more competitive. In short, it can greatly reduce the TOC (Total Own Ship Cost) of the enterprise. Therefore, the development speed of e-commerce is astonishing and rapid (the development of e-commerce basically synchronizes with the development of Internet users, while the development speed of Internet reaches 250% in China and more than 50% in the world.)
Specifically , the application development of e-commerce has the following characteristics.
(1) The depth of e-commerce will be further expanded
目前受限于技术创新和应用水平,企业发展电子商务仍处于起步阶段。随着这两方面水平的提高以及其他相关技术的发展,电子商务将向纵深挺进,新一代的电子商务将浮出水面,取代目前简单地信托“网站+电子邮件”的方式。电子商务企业将从网上商店和门户的初级形态,过渡到将企业的核心业务流程、客户关系管理等都延伸到Internet上,使产品和服务更贴近用户需求。互动、实时成为企业信息交流的共同特点,网络成为企业资源计划、客户关系管理及供应链管理的中枢神经。企业将创建、形成新的价值链,把新、老、上、下游利益相关都联合起来,形成更高效的战略联盟,共同谋求更大的利益。
(2) 电子商务将向各行各业迅速渗透
电子商务的倡导者是世界的IT业的巨人IBM,HR,Microsoft,电子商务的实施首先是金融服务业(包括银行系统、股票买卖系统、保险系统还有图书销售的Amazon等服务业公司)中,接着是大型的跨国公司(如DELL、通用汽车,在我国尚无几家大型跨国公司的条件下,我国家电行业的巨人春兰、海尔、TCL等都积极推进电子商务计划)中,然后才是传统的加工制造业、零售企业和中小企业,从而实现电子商务对传统产业、零售业和中小企业的嫁接和改造。最后还要扩大到政府部门、军事部门、医疗卫生部门、教育部门等公用事业部门。目前电子商务在我国的情况是金融业已经全面开展,并不断地深入;其他的服务业尚未进入这一领域;大型企业刚刚开始进入,有待进一步的发展;其他应用目前还谈不上。今后的发展将是向这些行业不断的需要。而随着中国加入WTO,电子商务将渗透到国内的各行各业,这是我们国家必然的、唯一的选择,也是我国各行各业所能做出的必然的、唯一的选择,对中国的传统经济也是一个严峻挑战。
(3) 电子商务的地域范围将迅速扩大
E-commerce technology originated in the United States, which has unique advantages in electronic information technology. The reason why the U.S. advocates tariff-free e-commerce activities is because U.S. electronic information technology is the backbone of the U.S. economy, and U.S. electronic information technology has almost monopolized the global market, and all electronic and information technology transactions are very suitable for online transactions. If the global E-commerce activities are free of tariffs, which means that the electronic information technology of the United States can obtain a global market without borders and tariffs. From this point of view, the United States has spared no effort to promote e-commerce, with the purpose of economic colonization and technological hegemony, and various countries have to be on guard. But whether you like it or not, just like the United Kingdom back then, no matter whether you like English and steam engines or oppose English and steam engines, English and steam engines still do not depend on our will. Steam engines are popular all over the world, English become the lingua franca of the world. This is the international competition of survival of the fittest and survival of the fittest. It is precisely because of this that, in terms of attitude towards e-commerce, no country, whether developed or developing, resists it passively, but competes for a certain share in e-commerce technology. Advantages (Hong Kong's Cyberport plan, Malaysia's Super Multimedia Corridor, and Singapore's Electronic Information Port plan are the products of various countries and regions competing for the commanding heights of e-commerce), and will not be eliminated by the international community. It is precisely because of such scrambling competition and the strong support of governments that e-commerce will rapidly expand from developed countries to developing countries, including the least developed countries.
(4) There will be a boom in mergers of e-commerce websitesFirst
of all, similar mergers. At present, there are tens of millions of large and small websites on the Internet, and there are quite a few websites with the same or similar positioning and similar business content (especially In our country this problem is more serious). Due to limited resources, only the top-ranked websites will win in the end. Those leading e-commerce companies have great advantages in terms of resources, brands, and customer scale. If these websites with good foundation and development prospect want to develop, they must adopt complementary acquisition strategies and form strategic alliances. Since personalization and specialization are the two major trends in the development of e-commerce, and each website is always limited in terms of resources, and the needs of customers are all-round, so different types of websites will cooperate with each other in the form of strategic alliances. become an inevitable trend.
(5) Industrial e-commerce will become the mainstream of next-generation e-commerce development
The typical feature of e-commerce entering a period of rapid development is that venture capital and website positioning will shift from the previous "big and comprehensive" model to professional and subdivided industry business portals. E-commerce companies must also conduct serious research on market segmentation in order to meet the different needs of consumers for e-commerce. The first generation of e-commerce focuses on content, the second generation focuses on comprehensive e-commerce, and the next generation of industry e-commerce tightly integrates value-added content and business platforms, giving full play to the advantages of the Internet in information services, making e-commerce truly Enter the practical stage.
(6) E-commerce will give birth to EASP (e-commerce Application Service Provider)
. There are a series of problems such as high cost, long effective period, unsatisfactory effect, lack of standardized application system, and continuous upgrading of software and hardware. With e-ASP e-commerce application service providers, small and medium-sized enterprises can transfer the above-mentioned problems to them to solve, and only focus on making their own products and services well. [1]
1.2 Realization tasks of the system
The popular online shopping system should not only have a beautiful webpage, but also have a rigorous planning and pay attention to every small link. Only in this way can unnecessary errors be avoided during electronic transactions. We will use HTML, JSP and other technologies to edit web pages, and use JDBC technology to associate databases with dynamic web pages. The traditional information acquisition method of the management information system is to input information into the database of the management system by professional text entry personnel. This method has many applications when the amount of data is not large. When the amount of data is relatively large and highly professional, the cost of input and the possibility of errors will increase accordingly. The solution of this design in practical application is to establish a website and its own database, so that the required commodity information can be saved and updated in time, and the situation of commodity trading can be better understood in a timely manner.
2
System overview and implementation technology introduction
2.1 Introduction to online shopping mall
Online shopping mall, also known as e-commerce system, e-commerce comes from English ELECTRONIC COMMERCE, abbreviated as EC. As the name suggests, its content includes two aspects, one is electronic, and the other is business activities. E-commerce refers to the use of simple, fast, and low-cost electronic communication methods to conduct various business activities between buyers and sellers without meeting each other.
Electronic commerce can be accomplished through a variety of electronic communication methods. Simply put, for example, if you conduct business activities with customers by calling or sending faxes, it seems that it can also be called e-commerce; however, the e-commerce that people are discussing now is mainly based on EDI (electronic data interchange) and Internet. Completed. Especially with the increasingly mature Internet technology, the real development of e-commerce will be based on Internet technology. So some people call e-commerce IC (INTERNET COMMERCE) for short.
From the perspective of trade activities, e-commerce can be realized in multiple links, so e-commerce can also be divided into two levels, the lower level of e-commerce such as electronic business conditions, electronic trade, electronic contracts, etc.; the most complete is also The most advanced e-commerce should be able to carry out all trade activities using the INTENET network, that is, the complete realization of information flow, business flow, capital flow and some logistics online, that is to say, you can start from looking for customers and continue to Negotiation, ordering, online payment (receipt), issuance of electronic invoices, electronic customs declaration, electronic tax payment, etc. are all done in one go through the Internet.
As a new type of business, e-commerce provides enterprises with a virtual global trading environment, which greatly improves the level of business activities and service quality. The advantages of the new business communication channel are obvious, and its advantages include:
(1) The communication speed is greatly improved, especially the communication speed in the international range.
(2) Save potential expenses, such as e-mail saves communication postage, and electronic data exchange greatly saves management and personnel costs.
(3) The connection between customers and suppliers has been increased. For example, the e-commerce system network site enables both customers and suppliers to understand each other's latest data.
(4) The service quality has been improved, and the information of the enterprise and its products and the services required by customers can be provided in a fast and convenient way.
(5) Provides an interactive sales channel. So that businesses can get market feedback in time and improve their own work.
(6) Provide round-the-clock service, that is, 24 hours a day, 365 days a year.
(7) The most important point is that e-commerce enhances the competitiveness of enterprises.
Here, what we want to discuss is the logistics management of the online shopping mall, and the electronic logistics should be an integral part of the concept of e-commerce. An e-commerce process is incomplete without a modern logistics process. Logistics is the ultimate guarantee for realizing the "customer-centric" concept in e-commerce. Without modern logistics technology, e-commerce brings zero shopping convenience to consumers, and consumers will inevitably turn to traditional shopping that they think is safer. way, then what is the need for online shopping? With the development of network technology and electronic technology, electronic intermediary has been introduced into production, exchange and consumption as a tool, and human beings have entered the era of electronic commerce. In this era, the order in which people do trade has not changed, there are still several stages before, during and after the transaction, but the tools for communication and contact have changed, such as from the previous paper documents to the current Electronic documents. An important feature of this stage is that the flow of information has changed (electronically), and it is more manifested as the flow of bills and materials. At this time, information flow is in an extremely important position. It runs through the entire process of commodity trading, controls the entire process of commodity circulation at a higher position, and records the entire business process. , An important basis for business decision-making. In the era of e-commerce, due to the application of electronic tools and network communication technology, the time and space distance between the parties to the transaction is almost zero, which favorably promotes the organic combination of the "four streams" of information flow, business flow, capital flow, and logistics area. For some goods and services that can be transmitted through the network, it is even possible to achieve "four-stream" synchronous processing. For example, users can complete the entire shopping process for a certain electronic software by browsing, querying, selecting, and clicking on the Internet. Therefore, barcode technology (BarCode), database technology (Database), electronic ordering system (EOS: ElectronicOrderingSystem), electronic data interchange (ElectronicDataInterchange, EDI), quick response (QuickResponse, QR) and effective customer reflection (EffectiveCustomerResponse, ECR), Technologies and concepts such as Enterprise Resource Planning (ERP) will be widely used in my country's logistics.
Our topic is about the application of EOS system in e-commerce such as online shopping mall.
Electronic Ordering System (Electronic Ordering System referred to as EOS) is a technology for retailers, wholesalers, and manufacturers to use computers to comprehensively manage ordered goods. It can quickly and accurately transmit order information, grasp product information, and build a system of purchase, inspection, and replenishment that is not out of stock, error-free, or delayed. The electronic ordering system inputs the ordering data generated at wholesale and retail locations into the computer, and immediately transmits the data to the head office, wholesaler, commodity supplier or manufacturer through a computer communication network connection. Therefore, EOS can handle all the operations of the product transaction process from the explanation of new product information to the accounting settlement. It can be said that EOS covers the entire business flow. Today, with the rapid spread of network technology, EOS has become an important part of modern logistics management, which enables zero inventory to be realized. In a modern commercial society where information flows out in large quantities, transaction volume and transaction frequency are getting higher and higher, the retail industry no longer has a lot of space and time for storing goods. The EOS system must be adopted on the premise that suppliers are required to make up the quantity of goods sold in a timely manner and there must be no shortage of goods. The rich content and advanced management methods contained in EOS enable it to be widely used internationally. EOS is an overall operating system between many retailers and suppliers, rather than a system between a single retail store and a single supplier. The electronic ordering system establishes a high-speed channel between the retailer and the supplier, so that the information of both parties can be communicated in a timely manner, and the cycle of the ordering process is greatly shortened, which not only ensures the timely supply of goods, but also accelerates the turnover of funds. zero inventory strategy.
Enterprises that enter e-commerce may not necessarily make money, but enterprises that do not enter e-commerce will definitely be eliminated in the future. It is this awareness of the promise of the future that has led to the emergence of many online marketplaces. Compared with traditional shopping malls, online shopping malls have many new features:
(1) Electronic writing and digital transmission. Use paperless trade as much as possible to realize fast, accurate, two-way data and information exchange. You can use non-real-time emails and real-time discussion groups to understand commodity markets and commodity information, and provide a form of remote communication.
(2) There is no store rental cost. The online store only needs a server connected to the network or renting part of the network server space.
(3) There is no pressure on commodity inventory. Online orders can be delivered directly to the publishing house, and the publishing house can implement zero-stock printing.
(4) 便于收集读者信息,为读者提供个性化服务。根据读者浏览、购买的信息,分析读者的阅读兴趣,当读者再次访问时直接推荐有关商品或定期向其发送有关商品的电子邮件。
(5) 品种规模大,经营时间久,上架寿命长。一般传统的大型书城,商品品种不超过20万种,网上商城在理论上可有无限多的品种。“网络不打烊”,只要服务器工作正常,网友就能查到并订购商品,不受时间的限制。
实行无国界经营。只要知道域名,全世界都可访问,不受空间的限制。
2.2 相关实现技术介绍
2.2.1 JSP语言及其特点
在传统的网页HTML文件(.htm,.html)中加入Java程序片段(Scriptlet)和JSP标记(tag),就构成了JSP网页(*.jsp)。JSP页面看上去象标准的HTML和XML页面,并附带有JSP引擎能够处理和抽取的额外元件。
Web服务器在遇到访问JSP网页的请求时,首先执行其中的程序片段,然后将执行结果以HTML格式返回给用户。
程序片段可以操作数据库、重新定向网页以及发送E-mail等,这就是建立动态网站所需要的功能。
所有程序都在服务器端执行,网络上传送给客户端的仅是得到的结果,对客户浏览器的要求最低。它基于强大的Java语言,具有良好的伸缩性,在网络数据库应用开发领域具有得天独厚的优势。
JSP技术在多个方面加速了动态Web页面的开发:

  1. Separation of content generation and display
    Using JSP technology, Web page developers can use HTML or XML tags to design and format the final page. Use JSP tags or small scripts to generate dynamic content on the page (content that changes based on a request, such as requesting account information or the price of a specific bottle of wine). The logic for generating content is encapsulated in the logo and JavaBeans components, and bundled in small scripts, all scripts run on the server side. If the core logic is encapsulated in the logo and Beans, such as Web managers and page designers, they can edit and use JSP pages without affecting the generation of content.
    On the server side, the JSP engine interprets JSP tags and scriptlets, generates the requested content (for example, by accessing JavaBeans components, accessing databases using JDBCTM technology, or including files), and sends the results as HTML (or XML) pages back to the browser. This helps authors protect their code while ensuring full usability in any HTML-based Web browser.
  2. Emphasis on reusable components
    Most JSP pages rely on reusable, cross-platform components (JavaBeans or EnterpriseJavaBeansTM components) to perform more complex processing required by the application. Developers can share and exchange components that perform common operations, or make these components available to a wider community of users or customers. A component-based approach speeds up the overall development process and enables organizations to balance their existing skills and development efforts to optimize results.
  3. Using logos to simplify page development
    Web page developers are not all programmers who are familiar with scripting languages. JavaServerPage technology encapsulates much of the functionality required for dynamic content generation in easy-to-use, JSP-related XML markup. Standard JSP tags can access and instantiate JavaBeans components, set or retrieve component properties, download Applets, and perform functions that are more difficult to code and time-consuming in other ways.
    JSP technology is extensible by developing a custom logo library. In the future, third-party developers and others can create their own identity libraries for common functionality. This enables Web page developers to work with familiar tools and components that, like logos, perform specific functions.
  4. JSP can provide all Servlets functions
    Compared with Servlets, JSP can provide all Servlets functions, it is more convenient than writing and modifying HTML with Println. The division of labor can be made more clearly, with the Web page designers writing the HTML, leaving room for the Servlets programmers to insert the dynamic parts. JSP technology can support highly complex web-based applications.
  5. Robust storage management and security
    Since the built-in scripting language of JSP pages is based on the Java programming language, and all JSP pages are compiled into JavaServlets, JSP pages have all the benefits of Java technology, including robust storage management and security .
  6. Write once, run anywhere
    As part of the Java platform, JSP has the "write once, run anywhere" feature of the Java programming language. As more vendors add JSP support to their products, you can use the server and tools of your choice, changing tools or servers without affecting your current application.
    Introduction to JavaBean: JavaBean is a Java-based software component. Like Active controls, JavaBean can create a set of reusable object libraries by encapsulating business logic. JSP provides comprehensive support for integrating JavaBean components in Web applications. This support can not only shorten development time (you can directly use tested and trusted existing components), avoid repeated development, but also bring more benefits to JSP applications. Much scalability. JavaBean components can be used to perform complex computing tasks, or be responsible for interaction with databases and data extraction.
    Due to the characteristics and advantages of the Java language in these aspects, the software JavaBean component technology based on it has attracted much attention. Its mission is: write once, execute anywhere, and reuse anywhere. JavaBean components can be reused anywhere, including in applications, other components, documents, Web sites, and application builder tools.
    In order to create and use Java software components, JavaBean is implemented as an application programming interface independent of platform and structure. Its implementation can ignore internal structure and details, and only need to define its external characteristics and external functions. Among them, the three interfaces of attributes, methods and events can be developed independently. [2]
    2.2.2 Knowledge introduction of DreamweaverMX
    Dreamweaver is one of the most familiar development tools for webpage creators, with powerful functions and friendly interface. A big boost. Added powerful features include:
  7. 直观的新工作区
    通过标记的文档窗口、可对接的面板组、可自定义的工具条和集成的文件浏览,节省宝贵的开发时间。
  8. 更加强大的模板
    为分发人员设置尖端的规则,以便在不影响站点设计的情况下输入内容。嵌套的模板支持更为自定义的布局控制,而可编辑和可选的地区则允许分发人员更加灵活地输入内容。
  9. 广泛的代码库
    使用预置的代码库创建插入和更新表单、记录集导航页和用户认证页。通过用现场数据填充设计视图来测试布局。
  10. 新服务器技术支持
    DreamweaverMX新增了对构建ColdFusionMX、ASP.NET和PHP网站的支持,以及对开发ASP、JSP和传统ColdFusion应用程序的支持。
  11. 帮助您起步的示例内容
    利用专业质量的、预置的布局和代码,包括站点结构、表单、可访问的模板和JavaScript客户机方交互功能。运用能够即时为动态站点、静态站点或ISP托管的站点配置站点信息的站点设置向导,快速创建新站点。
  12. XML和Web标准支持
    通过XML支持保持前沿领先优势,包括编辑、确认和导入纲要。轻易地自省ColdFusion、.NET和Java中基于XML的web服务。通过XHTML输出的默认创建及标准HTML到XHTML的简单转换,确保标准一致性。
  13. 改进的级联样式表2(CSS2)支持
    使用DreamweaverMX中改进的CSS渲染和设计工具,构建符合最新CSS标准的站点。DreamweaverMXCSS面板经过增强,可显示内外部定义的样式,并支持仅设计时间样式表。
  14. High-Performance New Coding Features
    Write your own code faster with high-performance coding features such as code hints, markup editor, scalable color coding, markup selector, code snippets, and code confirmation.
  15. Accessibility
    Stay abreast of the latest US laws and international standards with page and site compliance checks, in-product reference content, and accessibility active authoring.
  16. Beginners optimizing
    ColdFusion for ColdFusionMX development will find the site guides, code samples, and reference material helpful. And advanced developers can take advantage of the latest ColdFusionMX features, including ColdFusion components, web services, and integrated debugging and tracing. [3-]
    2.2.3 Introduction to basic database knowledge
  17. Database Model
    A model is an abstraction of the real world. In database technology, we use the concept of model to describe the structure and semantics of the database, abstract the real world, and the model that represents the entity type and the relationship between entities is called "data model".
    Currently widely used data models can be divided into two types. One is a model independent of the computer system, which does not involve the representation of information in the system at all, and is only used to describe the information structure that a particular organization cares about. This type of model is called a "conceptual data model". The essentials model is used to establish a data model of the information world, emphasizing its semantic expression function. The concept should be simple, clear, and easy for users to understand. It is the first layer of abstraction in the real world and a tool for communication between users and database designers. Another data model is directly oriented to the logical structure of the database, which is the second level of abstraction of the real world. This type of model involves computer systems and database management systems, also known as "structured data models."
  18. Hierarchical model
    A data model that expresses entity types and relationships between entities in a tree structure. The nodes of the tree are record types, and each non-root node has one and only one parent node. The connection between the record type of the upper layer and the record type of the lower layer is a 1:N connection.
    The characteristic of the hierarchical model is that the connection between records is realized through pointers, and the query efficiency is high. However, the hierarchical model has two disadvantages: one is that it can only represent 1:N relationship, although there are many auxiliary means to realize M:N relationship, but they are all complicated and difficult for users to grasp; And complex, causing data query and update operations are also very complex, therefore, writing applications is also very complex.
  19. Network model
    A data model that expresses entity types and relationships between entities with a directed graph structure. The nodes in the directed graph are record types, and the directed edges indicate that the relationship between the record types at the end of the arrow and the record types at the end of the arrow is a 1:N relationship.
    The characteristics of the network model: the connection between records is realized through pointers, and the M:N connection is also easy to realize (each M:N connection can be split into two 1:N connections), and the query efficiency is high. The disadvantage of the network model is that it is more complicated to write the application program, and the programmer must be familiar with the logical structure of the database.
  20. Relational
    Model The main purpose of the relational model is to express the entity set with a two-dimensional table structure, and to express the relationship between entities with a foreign key. A relational model is a collection of several relational schemas. The relational schema is equivalent to the aforementioned record type, and its instances are called relations, and each relation is actually a two-dimensional table.
    The biggest difference between the relational model and the hierarchical and mesh model is that key codes are used instead of pointers to navigate data, the tables are simple and easy for users to understand, and programming does not involve details such as storage structure and access technology. The relational model is a mathematical model. The SQL language is a standardized language for relational databases and has been widely used.
    The biggest difference between the relational model and the network and hierarchical models is that the relational model uses tabular data instead of linking pointers to represent and realize the relationship between entities. The data structure of the relational model is simple and easy to understand. Only need to use simple query statement to operate the database.
    The relational model is a mathematical model, and the table can be regarded as a set, so knowledge such as set theory and mathematical logic can be introduced into the relational model. The relational model is a mature and promising model, which has been widely used.
  21. Object-oriented model
    The object-oriented model can completely describe the data structure of the real world and has rich expressive ability, but the model is relatively complex and involves a wide range of knowledge, so object-oriented databases have not yet reached the popularity of relational databases.
  22. Database architecture
    The architecture of the database is divided into three levels: internal level (internal), conceptual level (conceptual) and external level (external). This three-level structure is sometimes referred to as the "three-level schema structure", or "three levels of data abstraction". Although the products of DBMS are various and work under the support of different operating systems, most of the systems have the structural characteristics of the three-level model in the overall architecture. The characteristics of data seen from a certain angle are called "data views".
    The external level is closest to the user and is the data characteristics that a single user can see. The description of the view of data used by a single user is called an "external schema".
    The conceptual level involves data definitions of all users and is a global data view. The description of the global view of data is called a "conceptual schema".
    The internal level is closest to the physical storage device and involves the structure of the actual data storage. The description of the physically stored data view is called an "internal schema".
    The three-level schema structure of a database is three levels of abstraction for data. It leaves the specific organization of the data to the DBMS, and the user only needs to process the data abstractly, without having to care about the representation and storage of the data in the computer, thus reducing the burden on the user to use the system.
    There are often great differences between the three-level structures. In order to realize the connection and conversion of the three abstract levels, the DBMS provides two levels of mappings between the three-level structures: external schema/schema mapping, schema/internal schema image. Schema here is an abbreviation for Conceptual Schema. [4]
    2.2.4 JDBC basic knowledge introduction
    JDBC是Java的开发者—Sun的Javasoft公司制定的Java数据库连接(JavaDataBaseConnectivity)技术的简称,是为各种常用数据库提供无缝联接的技术。JDBC在Web和Internet应用程序中的作用和ODBC在Windows系列平台应用程序中的作用类似。ODBC(OpenDataBaseConnectivity),称为开放式数据库互联技术,是由Microsoft公司倡导并得到业界普遍响应的一门数据库连接技术,如果读者有使用ODBC编程的经验,就会发现JDBC与ODBC很类似。JDBC现在可以连接的数据库包括:xbase、Oracle、Sybase、Aceess以及Paradox等。
    如果用户是从事软件领域工作的,不可能没有听说过SQL(StructureQueryLanguage:结构化查询语言),它是一种标准化的关系型数据库访问语言。在SQL看来,数据库就是表的集合,其中包含了行和列。SQL标准虽然也还处在不断变革之中(任何一门标准如果已一成不变了,那只能说明这门学科已经停止发展了),但其基本内容相对稳定。JDBC定义了Java语言同SQL数据之间的程序设计接口。
    JDBC有一个非常独特的动态连接结构,它使得系统模块化。使用JDBC来完成对数据库的访问包括以下四个主要组件:Java的应用程序、JDBC驱动器管理器、驱动器和数据源。
    JavaSoft has developed JDBC API, which is a standard and unified SQL data access interface. The role of JDBC in the Internet is similar to that of ODBC in the Windows family. It provides an interface for Java programs to seamlessly operate various databases. When programming, programmers don't need to care which manufacturer's product the database they want to operate is, thus improving the versatility of the software. Anticipate what type of database your users want to access. JDBC applications can access their associated data as long as the correct driver set is installed on the system.
    2.3 The main structure and development mode of
    the system The key to the construction of the system lies in the structure it uses. For a web-based system such as online shopping, the traditional c/s structure can no longer meet the access and operation of a large number of users. The b/s is based on browsing The architecture of the server is the mainstream of the current network system application. It will hand over a large amount of data processing work to the server. The client can access the system only through the ordinary IE browser, which is convenient, fast and conducive to system update and maintenance. , the java language is unique in this respect, and the emergence of the j2ee specification makes the development of the system more standardized, the level is clearer, it is more conducive to the processing of complex affairs, and it is also better in terms of security. The development process based on mvc makes the development process more clear, which is conducive to the implementation of some complex logic, thus saving the development cycle and development costs.
    2.3.1 Architecture based on B/S
    In the B/S architecture system, the user sends requests to many servers distributed on the network through the browser, and the server processes the browser's request and returns the information required by the user to the browser. The B/S structure simplifies the work of the client, and only a small amount of client software needs to be configured on the client. The server will take on more work, and the access to the database and the execution of the application will be done on the server. The browser sends out the request, and the rest of the work such as data request, processing, result return and dynamic web page generation are all completed by the WebServer. In fact, the B/S architecture separates the transaction processing logic module of the two-tier C/S structure from the tasks of the client, and a single layer is formed by the Web server to undertake its tasks, so that the pressure on the client is reduced, and the The load is distributed to the web servers. This three-tier architecture is shown in Figure 2-1.

图2-1 B/S架构示意图
这种结构不仅把客户机从沉重的负担和不断对其提高的性能的要求中解放出来,也把技术维护人员从繁重的维护升级工作中解脱出来。由于客户机把事务处理逻辑部分分给了功能服务器,使客户机一下子“苗条”了许多,不再负责处理复杂计算和数据访问等关键事务,只负责显示部分,所以维护人员不再为程序的维护工作奔波于每个客户机之间,而把主要精力放在功能服务器上程序的更新工作。这种三层结构在层与层之间相互独立,任何一层的改变不会影响其它层的功能。
2.3.2 基于MVC的应用开发模型
在传统的基于Web的应用系统中,例如ASP,CGI等,通常开发者将业务逻辑,数据逻辑、展示逻辑等混杂在一起,在同一个界面面里既进行后台数据库的访问和操作,同时还包含业务流程和页面表示。这样编写出来的程序,既不利于程序员对业务代码的调试,同时也不利于编辑人员进行交互页面的设计。同时系统也不具备可扩展性,当我们要在现有业务上进行扩展的时候,通常无法借助于现有的资源和应用,而只能够重新编写,大大增加了投资,延长了系统上线的时间,失去了竞争市场的优势。
在本网上购物系统中,将采用通行的MVC模式来构建应用。这种结构解决了前面所述的所有问题,在我们的应用集成网络中,通过企业级高端J2EE应用服务器实现MVC开发模型。MVC的逻辑图如下:

图2-2 应用服务器之上采用MVC开发的逻辑示意图

Figure 2-3 Schematic diagram of MVC business process
Through this solution, we can quickly realize the entire business, and its advantages and characteristics are as follows:
Model (model) layer: implemented by EJB components, EJB encapsulates specific services inside components, with Excellent features such as security, high performance, and reusability.
View (view) layer: composed of JSP and HTML. The feature of this level is that it can truly display the interface that interacts with customers, and has descriptive functions. At the same time, it can nest dynamic data and display dynamic pages. At the same time, the personalized customization of the client can be easily carried out. Display different styles of interface according to the needs of each customer.
Controller (controller) layer: It is a very important layer. This layer is the link between View and Model, and it is also a tool to separate the two layers to the maximum extent. It is usually implemented by Servlet. Although Servlet and JSP are both page display tools, they belong to two layers. The main reason is that JSP exists in the form of a scripting language, and its main advantage is the Web display of dynamic data, while Servlet is a complete Java program, and its strengths are business calls and process processing.
Through the establishment of this model, our application system has very good performance and scalability. Separating business components and display pages, and describing the calling relationship through Controller, can improve efficiency on the one hand, and increase the ability of system expansion on the other hand, so that our system can expand the business at the fastest speed to meet different requirements. Users, different stages, and various business needs.

3 System Requirements Analysis and Feasibility Analysis
3.1 Requirements Analysis
Compared with general information system construction, website construction has both common characteristics and characteristics of development. The commonality is that website construction must proceed from actual needs. Engage in development work according to the general rules and methods of system development. Its characteristics are reflected in the development process and people's artistic meaning and ideas must be added in order to make the website lively and full of vitality.
The online shopping mall should not only reflect its characteristics of rich information, convenient retrieval, and fast shopping, but also pay attention to humanized design, which conforms to people's daily shopping habits, makes users feel friendly, and is easy to operate.
3.1.1 Functional overview
First of all, make a reasonable positioning of the website, and determine the overall style of the website according to the positioning of the website. The online shopping mall is a popular website for all consumers, so the interface design should be approachable, the website layout should be clear, the various information and functions should be obvious, the operation functions should be simple, the color matching of the website should be reasonable, and the colors between pages should be consistent. To cooperate with each other and connect the transition.
In addition, according to the functions to be realized by this system, the website is divided into two parts, namely the front-end user system and the back-end management system.
Generally speaking, an online shopping mall consists of a front-end system and a back-end system. The front-end system is a website facing users on the Internet. The background system is the system for the mall administrator to manage and maintain the website and its information.
The front-end user system is the customer-facing website interface, which is where customers directly access and make purchases. The function arrangement of the front-end system should be reasonable, and the function settings of the front-end system should be determined according to the positioning of the website and the user group. The front desk of this system includes the functions of six parts: new product shelf, hot product recommendation, product information retrieval, member center, shopping cart and order processing.
New shelf: According to the date of the shelf, the picture of the latest part of the shelf will be displayed to the user.
The administrator can display new products to users through the sub-module, and at the same time, the administrator can add products as needed. For example, some products have been purchased by many customers during this period, and the administrator will add them to the new shelf.
Hot items: sort according to the sales volume of the items, and display the items with the highest number of visits to users.
Through the sub-module, users can quickly know which products are hot-selling products. If the product sales volume is large, it means that customers like this product, or the quality of this product is better than other products. With this Module users can quickly learn about the sales ranking of products.
Commodity information retrieval: Provide single-condition retrieval and multi-condition fuzzy retrieval.
Through this module, users can query products according to their needs. Product information query is mainly divided into product name query, product category query and product number query. The above methods can enable users to find out the products they need according to the information they know. This can speed up the efficiency of customer purchases.
Member Center: including member services for member registration.
The characteristic of members is that they have certain discounts when purchasing goods, and the price is lower than that of ordinary users.
Shopping cart: Save and modify the user's current shopping information.
The shopping cart mainly saves the items that the user wants to buy and displays them in the shopping cart.
The user must first become a member of the online shopping mall, then select products on the website and add them to the shopping cart, and then process the order after putting all the products in the shopping cart. After the order is placed, the website will update the database information to record the order information, pay after confirmation, and deliver the goods after the website receives the payment. The shopping flow chart is shown in Figure 3-1 below:

3-1 Shopping flow chart
The background management system provides various management functions for store management, because the management of a store is a very complicated process, often involving many different management processes and systems. As an online store, this system should have its own background management system, which is used to complete the website management product information, background order management (including payment, delivery, cancellation, etc.), member information management, administrator information management and other functions.
Commodity information management: It is the maintenance of commodity data, adding new commodity information into the warehouse.
Information management is mainly to update the information of some commodities, for example, the price of some commodities needs to be adjusted, and some commodities need to be sold at a discount recently, which can be realized quickly through this module.
Member information management: Provide administrators with the ability to modify and maintain member registration information.
This module is used to browse and delete registered users. If a user registers intentionally or has not purchased a product for a long period of time, the administrator can delete the user. Administrators can also update user information.
Administrator information management: including modifying the password of the administrator, and logging out of the administrator.
The administrator is mainly used to manage the background of the mall.
3.2 Feasibility analysis
Commercial enterprises are often restricted by the following conditions during their operation:
(1) The publicity of products is limited, and buyers or customers can only obtain various information through door-to-door consultation and telephone communication. It is limited by certain time and physical space and the cost is high.
(2) Huge commercial economic turnover.
(3) Complex product turnover channels. A series of product turnover channels from looking at samples, negotiating prices to paying for goods are too complicated, and there is a lack of comprehensive communication and fast operation platforms between enterprises and customers.
(4) According to seasonal changes in commercial enterprises, the supply of hot-selling products is tight when the sales peak arrives. The industry needs to know the sales situation of the products in real time to ensure the satisfaction rate of the hot-selling products.
因此,企业需要重新认识市场、消费者以及自身市场定位,正确认识电子商务技术在企业中的重要地位,以少量的时间和资金建立企业信息门户网站并架设一定范围的商务网络,以此来制定长远发展战略,使企业与顾客间的经济活动变得更灵活、更主动。
4
总体设计
4.1 项目总体设计
4.1.1 设计思想
网上商城是一种全新的销售方式,随着互联的网普及,新技术的层出不穷,在线交易的安全性不断的提高,都为网上商城如雨后春笋般的发展奠定了良好的基础。由于商品这种商品易保存,配货方便,运输过程中安全性高,另外商品货物信息在网上可以比其它商品更容易直观真实地向用户展示,折扣率也较高,所以目前国内各大网上商城比较红火。
我们开发网上商城系统,首先要从客户角度出发,提供良好的用户界面,对网站的布局、功能的设计尽量采用人性化设计,使用户感觉亲切,在首先在视觉上引吸顾客。提供方便快捷操作功能,使无论什么知识水平的用户都能很快的对购物系统熟练使用。提供功能强大的检索系统,快速地检索到站内所有信息。能按着用户的要求快速准确的显示出所有商品信息,并且能够方便添加到购物车内。提高网站的安全性及信息的准备性,保证个人的购物信息的保密性,加强用户购物过程的安全性。提供对购物车内商品信息的修改,确认后下定单。提供安全的在线支付方式及全面及时的配货方式。
4.1.2 总体框架设计
电子商务系统是一个典型的JSP数据库开发应用程序,由前台商品展示及销售、后台管理2部分组成。

  1. 前台商品展示及销售:
    该部分主要包括特价商品、销售排行、购物车、会员管理、商品公告及查看购物车、商品查询等。
  2. Background commodity management and user management:
    This part mainly manages some basic data in the mall effectively, including commodity management, member management, etc. The functional structure diagram is as follows:

Figure 4-1 Functional module design diagram
From the figure, it can be seen that the online shopping system can be divided into two parts, the foreground and the backend. There are 6 modules for ordering products and product query; the background part is used by administrators, mainly including 3 modules of administrator authentication, product information management, and user information management.
4.2 Database design
4.2.1 Database design
Database design is usually based on an existing database management system. Commonly used database management systems include MYSQL, SQLServer, Oracle and so on. I have adopted the SQLServer2005 database management system, and the established database is called Shopping. The entire system function requires the following data items:
administrator: ID number, user name, login password.
Administrator Table 4-1
Field Description Data Type Remarks
Man_ID ID Number varchar(5) Empty
Man_name Administrator Name varchar(15) Empty
Man_password Administrator Password varchar(15) Empty
User: username, login password is not allowed , gender, contact address, contact number, user type.
User Table 4-1
Field Description Data Type Remarks
Mem_name Username varchar(16) Not allowed to be empty
Mem_password User password varchar(15) Not allowed
to be empty Mem_age User age int Can be empty
Mem_sex User gender varchar(5) Can be empty
Mem_addr User address varchar(20) can be empty
Mem_type User type varchar(5) Not allowed to be empty
Commodity: commodity number, name, price, membership price, type, brief description.
Commodity Table 4-2
Field Description Type Remark
Comm_ID Commodity No. Varchar(10) No Empty
Comm_Name Commodity Name Varchar(10) No Empty
Comm_Type Commodity Type Varchar(5) Empty
Comm_Price Commodity Price Int Empty
Comm_youhui Commodity Member Price Int Can be empty
Comm_Desc Commodity description Varchar(20) Can be empty
Commodity order table: number, order number, user name, commodity number, commodity name, commodity price, purchase quantity.
Commodity Order Table 4-3
Field Description Type Remark
Id No. Varchar(10) No Empty
Order_id Order No. Varchar(20) No Empty
User_name Username Varchar(15) No Empty
Goods_id Product No. Varchar(5) No Empty
Goods_name Commodity price Varchar(10) Not allowed to be empty
Goods_price Purchase quantity int Not allowed to be empty
User order form: number, order number, user name, contact number, zip code, mailing address, remarks, order time.
User Order Form 4-4
Field Description Type Remarks
Id No. Varchar(10) Not allowed to be empty
Order_id Order number Varchar(20) Not allowed to be empty
User_name Username Varchar(15) Not allowed to be empty
User_tel Contact number Varchar(10) Not allowed to be empty
User_post Zip code Varchar(10) Can be empty
User_addr Communication address Varchar(20) can be empty User_beizhu Remarks Varchar(20) can
be empty
User_date Order time datetime Not allowed to be
empty
The operation of consuming resources, therefore, a .jsp file is written for the database connection part in this system. The file name is Condb.jsp, and the key code is as follows:
<%!
StringdriverName="com.microsoft.sqlserver.jdbc.SQLServerDriver";
StringdbURL="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=Shopping";
StringuserName= "sa";//Default username
StringuserPwd="123";//Password
Connectionconn;
PreparedStatementpstmt=null;
ResultSetrs;
Stringsql=null;
try
{ Class.forName(driverName);//load database driver conn=DriverManager.getConnection(dbURL,userName,userPwd); } catch(Exceptione) { e.printStackTrace(); } %>[5] 5 detailed system design And Realization 5.1 General framework of the foreground The foreground part is used by users, including user registration, shopping cart management, personal data management and other parts.











  1. Module function introduction
    User management: In order to facilitate the management of the website, there must be a complete user management system. The website user management module consists of three parts: user registration, user login, and password retrieval.
    Shopping cart: The selected items must be saved via the shopping cart.
    Product display: In order to facilitate users to quickly find the products they need, the front desk also has all product queries, category queries, special sales products, and sales rankings
  2. Front-end file structure
    The front-end file structure of the shopping website is shown in Figure 5-1.

5-1 The functional structure of the front page of the website is shown in the figure
5.1.1 User management module
The user management module mainly includes two parts: user registration and login.

  1. User Registration Module

Figure 5-2 Registration flow chart
When the user logs in for the first time, he must first register and become a member before he can purchase items. Users can click the registration button on the home page to open the registration page for member registration operation. The operation result of the user registration page is shown in the figure.

Figure 5-3 Registration page
When you click the Submit registration button, you need to judge the corresponding conditions, such as user type, the passwords entered twice must be the same and the length must be greater than 3 and less than 10. The key code is as follows:

[6]

In order to facilitate the management of users on the management website, the registration information received on the index.htm user registration page must undergo strict filtering to ensure the uniqueness of registered users. After submitting the form, it is necessary to query the data in the data table. If there is no If it is found, it will prompt that the registration is successful when inserting the data table, otherwise it will prompt the user to be used by the station, please register again, the key code is as follows:
try
{ sql="select Mem_Name from Member where Mem_Name=?"; pstmt=conn.prepareStatement(sql ); pstmt.setString(1,Username); rs=pstmt.executeQuery(); if(rs.next()) { %> jsp:forwardpage=”zhuce.jsp” <jsp:paramname=”warnning”value=” <%=warning%>”/> </jsp:forward> <% } else { sql=”insert into Member(Mem_name,Mem_password,Mem_age,Mem_sex,Mem_addr,Mem_type) values ​​(?,?,?,?,? ,?)"; pstmt=conn.prepareStatement(sql); pstmt.setString(1,Username);

















pstmt.setString(2,password);
pstmt.setString(3,age);
pstmt.setString(4,sex);
pstmt.setString(5,Address);
pstmt.setString(6,type);
pstmt.executeUpdate() ;
}
}
2) User login module

Figure 5-4 Flow chart of user login
The user login window is set on the home page, mainly used to receive the user name and password entered by the user, and update the status information of the user in the website.
After clicking the login button in the member login window, the system will verify the user name and password to determine whether the user is a registered user, if registered, update the user's status in the website, and if not registered, reject the user The program code for login operation and login data verification is as follows:
request.setCharacterEncoding(“GB2312”);
String name=request.getParameter(“Username”);
String pass=request.getParameter(“Password”);
try
{ sql=”select Mem_Name from Member where Mem_Name=? and Mem_password=?”; pstmt=conn.prepareStatement(sql); pstmt.setString(1,name); pstmt.setString(2,pass); rs=pstmt.executeQuery(); if( rs.next()) { String name1=rs.getString(1); %> jsp:forwardpage=”index.jsp”/ <% } else {














%>
jsp:forwardpage=”index.jsp”
<jsp:paramname=”warning” value=”User does not exist, please register to use!”/> </
jsp:forward>
<%
}
}
After successful login, return to the homepage of the website and The user name is displayed in the upper right corner of the homepage of the website. The key code is as follows:
<%
request.setCharacterEncoding(“GB2312”);
String name1=(String)session.getAttribute(“name”);//Login username
if(name1!=null)
{ %>

Welcome <%=(String)session.getAttribute(“name”)%>   modify personal information      and modify password

<% } 5.1.2 Shopping cart module When shopping in a supermarket, you can select a lot of items into the shopping cart (basket) according to your needs. In online virtual shopping malls, a technology called "shopping cart" is usually used to simulate real life. This technology is very convenient to use. Not only can you add, view, modify, and clear the contents of the shopping cart at any time, but you can also go to the cashier to check out at any time. The shopping flow chart is as follows:

Figure 5-5 Shopping flow chart

  1. Add to cart
    Add to cart is to put the items selected by the user in the cart. When the user clicks the "I want to buy" button in the product display area on the home page of the front desk, the system will display the detailed information of the product on the item list page, and the running result is as follows:

Figure 5-6 Adding products
2) Checking the shopping cart
In order to facilitate users to check the shopping situation at any time, a link to check the shopping cart is added on the home page of the website, through which the selected item information can be displayed in the shopping cart. View the results of the shopping cart page operation as shown below:

Figure 5-7 Viewing the shopping cart
In the shopping cart, the user can see all the products that he has selected in the shopping cart. The user can select the purchase quantity of each product in this interface, and can delete the unwanted products.
try
{ res.setContentType(“text/html;charset=gbk”); Dao dao=new Dao(); Comm_dataBean ub=new Comm_dataBean(); HttpSession hs=req.getSession(true); ArrayList al=new ArrayList() ; String Comm_id=req.getParameter(“Comm_id”); if(Comm_id!=null) { if(hs.getAttribute(“goods”)!=null) //Add directly if it is not empty in HttpSession { al=(ArrayList) hs.getAttribute(“goods”); } ArrayList alGoods=new ArrayList(); alGoods=dao.getGoods(Comm_id); //alGoods gets the query result Comm_id=null; ub=(Comm_dataBean)alGoods.get(0); al .add(ub);

















pw.println(ub.getComm_ID());
hs.setMaxInactiveInterval(100);
hs.setAttribute(“goods”,al);
}
al=(ArrayList)hs.getAttribute(“goods”);
if(req.getParameter(“del”)!=null)
{
String del=req.getParameter(“del”);
al.remove(Integer.parseInt(del));
}[7]
当用户点击按钮我就买这些了后,要判断商品的存货数量是否足够,如果用户要买入的数量大于商品的存货数量要弹出提示,如果用户要买入的数量小于商品的存货数量则将每样商品的和全部消费总额计算出。其关键代码如下:
try{
res.setContentType(“text/html;charset=gbk”);
PrintWriter pw=res.getWriter();
ArrayListal=newArrayList();
HttpSession hs=req.getSession(true);
al=(ArrayList)hs.getAttribute(“goods”);
int Goods_num=0;//商品剩余数量
int Goods_lost=0;
for ( int i = 0 ; i < al . size ( ) i ++ )
{ Comm_dataBean ub = new Comm_dataBean ( ) ; ub = ( Comm_dataBean ) al . get ( i ) ; String Comm_id=ub.getComm_ID(); String ss=req.getParameter(“Comm_id”+i+””); Dao dao=new Dao(); Goods_num = dao . getNumber ( Comm_id ) ; Goods_lost=dao.lostNumber(Comm_id); int leafGoodsNumber=Goods_num-Integer.parseInt(ss); if(leafGoodsNumber<0) { res.sendRedirect(“buygoodsError.jsp?erroInfo=”+ub.getComm_name()); return false ; } } int sumMoney=0;//Configure default value boolean issuccess=false;//Specify the default value for(int i=0;i<al.size();i++) { Comm_dataBean ub=new Comm_dataBean(); ;



















ub=(Comm_dataBean)al.get(i);
String ss=req.getParameter(“Comm_id”+i+””);
String Comm_id=ub.getComm_ID();
int j=(Integer.parseInt(ss))*Integer .parseInt(ub.getComm_price());
sumMoney=sumMoney+j;
int leafGoodsNumber=Goods_num-Integer.parseInt(ss);
Dao dao=new Dao();
int lost_1=Goods_lost+Integer.parseInt(ss)
; dao.update(Comm_id,leafGoodsNumber,lost_1);
if(issuccess==false)
{ break; } }[8] 3) Generating orders Generating orders is the ultimate goal of online shopping malls, and all the previous functions are realized for Finally, an order that the user is satisfied with is generated as the basis. Here, an order number that can be checked by the user at any time should be generated, and the information of the products purchased in the user's order should be saved. When the user confirms that he will not change the shopping cart, he can go to the cash register to check out and generate an order. The checkout process is: read the product name, product quantity, product price information from the shopping cart, generate a unique order number, and also read the basic information registered by the user to form a complete order and write it into the database , checkout and fill in the order page as shown below.





In the order generation module, it is mainly used to call out user information and generate a unique order number (the order number is a combination of the login user name and a random number), call out user information is to completely operate the database, and use the session object to log in The last user name is saved, and when the order is generated, the saved user name is taken out of some data in the order from the user table of the database, and the user fills in some other information such as: zip code, contact number, payment method, and remarks. information, so that a complete order can be completed. After the user clicks submit, the above information is submitted to the database for storage, so that the user can view it later.

5-8 Fill in the order
5.1.3 Message board module
Message board is an indispensable part of a business website, it can enhance the communication between users and the website. Adding a message is a communication mode between users and users, and between users and the website. Only when the content that the user wants to express is added to the database can it be displayed in the browsing message board.
The user clicks the hyperlink of "Add Message" in the message board to open the add message page. This page is used to submit the message information entered by the user. After the message information is written, the user can click the submit button to display that the submission is successful. If you click to browse the message , to open the message board page, which displays all user messages, with the latest ones at the top.
The running result is shown in Figure 5-9:

Figure 5-9 Message board
When the user clicks the submit button on the add message page, the system submits the data table to the admin/addlea.jsp page, which is used to store the message content in the database. The key code is as follows: <
%
Date date=new Date();
String dat=date.toLocaleString();
Condb con=new Condb();
String username=request.getParameter(“username”);
int temp=con.executeUpdate(sql);
if(temp> 0){ %>

<%
}else{
%>

5.2 Background part
5.2.1 General framework of the background
The background function is only allowed to be used by users with administrator privileges, and it is the basis for realizing the foreground function. It mainly includes administrator identity verification, order information management module, adding product module, querying user information management module, adding link module, and announcement information management module. Background
function introduction

  1. Functional module introduction
    Administrator authentication: provide a background entry for legitimate users.
    User management: user list (user modification, deletion, addition), user consumption list
    Commodity management: commodity list (commodity modification, deletion, addition), commodity search, commodity sales query
  2. Background file structure
    The background file structure of the website is shown in the figure below.

5-10 Background Structure Diagram
3) Running Results of Background Homepage

5-11 Background running results
5.2.2 Administrator login
Click the administrator entry on the front page, and it will go to the administrator login page. The function of this page is to verify the identity of the administrator. After the user enters the user name and password and clicks the "Login" button, the system will judge the validity of the user name and password. The result of running the administrator login page is shown in the figure.

5-12 Background login page
5.2.3 Commodity information management
Click the hyperlink of "Commodity List" in the navigation area, a list of all commodities will be displayed on the right, and there is an Add Commodity button at the bottom of the list. After clicking, the system will open the add Product page, this page is mainly used to add product information to the database table to provide the data basis required for the display of product categories on the front home page. The running result of the directory adding page is shown in the figure.


5-13 In order to reduce errors in the page of adding products, when submitting product information, it is necessary to verify the validity of the data, and the price of the input product cannot be an empty character type. These tasks can be realized by Bean, or by scripting language Javascript written, the following is the script language function check () to complete.
In order to ensure the uniqueness of the information in the data table, when the user submits the form, the data table needs to be queried according to the product name entered by the user to ensure that the product does not exist in the data table before adding. The key code is as follows:
sql=”select Comm_ID from Comm_data where Comm_ID=?”;[9]
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,Comm_id);
rs=pstmt.executeQuery();
if(rs. next())
{ %> jsp:forwardpage=”Goods_add.jsp” <jsp:paramname=”warnning”value=”<%=warning%>”/> < /jsp:forward> <% } else { sql=insert into Comm_data(Comm_ID,Comm_Name,Comm_Desc,Comm_Type,Comm_Price,Comm_youhui)values(?,?,?,?,?,?)”; pstmt=conn.prepareStatement(sql) ;










pstmt.setString(1,Comm_id);
.
.
pstmt.setString(6,Comm_youhui);
pstmt.executeUpdate();
%>
jsp:forwardpage=”Goodsadd_success.jsp”/
<%
}
在商品列表中每个商品的右方有个超链接“修改”,当点击后系统将打开修改商品信息页面,该页面主要用于商品信息修改以方便管理员对每个商品信息的更新和修改。目录修改页面的运行结果如图所示。
[10]
5-14 修改商品信息
为了减少错误,在提交时,需要对数据的合法性进行验证,输入的商品价格不能是空字符型,商品名称也不可以为空,商品优惠价格不可以高于商品原有价格,这些任务可以由脚本语言Javascript编写,这里是用脚本语言函数check()来完成的。
当点击提交按钮后将更新数据库中的信息,其中商品编号是不可以修改的,管理员可以修改商品的出售价格以及商品的优惠后的价格,以达到对商品的信息的修改和更新。
在左侧导航区有个“商品销售查询”超链接,系统将打开商品销售查询页面,该页面主要用于商品的销售情况进行查询,这样可以让商品销售人员看到当天,当月,以及几个月的销售情况,此功能可以很方便的让管理员了解到商品的销售情况这样有利于管理员对进货有很大的帮助,这项功能可以很快的了解的哪重商品在最近销售最好,哪重商品销售较差,如此管理员就知道近期进什么货有利于销售,进什么和不利于销售。商品销售查询结果如图所示。

5-15 Commodity sales query
In order to reduce errors, when clicking query, the legality of the data needs to be verified, the date entered must correspond to the selected month, and the two text boxes entered during the quarterly query must be numbers And it is between 1 and 12, and the subsequent input data must be greater than the previous input data.
5.2.4 User Information Management
This module is used to browse and delete registered users. If a user registers intentionally or has not purchased a product for a long period of time, the administrator can delete the user. Administrators can also update user information. Click the "Query User Information" hyperlink in the navigation bar to enter the user information page, and the operation result is shown in the figure.

5-16 User Query Results
If you need to modify user information, click the "Modify" hyperlink to update the user information, and the page will jump to User_caozuo.jsp. On this page, the user's original information is output on the page, and the administrator can modify the information. When the user clicks to submit the modification, after the user's modified information is updated, the data in the database is updated to achieve a complete modification of the user information. The result of its operation is shown in the figure.

5-17 Modify user information
Through this function, the administrator can easily see the consumption of each user, and the administrator can delete the user who has not consumed for a long time. The result of its operation is shown in the figure.

5-18 User Consumption Query
After clicking the query button, it will jump to User_sale1.jsp, where the corresponding results will be queried according to the previous query conditions, and the key code is as follows: if(day==
" ”)
{ if(month1==””){ sql=”select User_name,Comm_Name,Buy_ListfromBuylist where year=? And month between ? and ?”; pstmt=conn.prepareStatement(sql); pstmt.setString(1,year2) ; pstmt.setString(2,mm); pstmt.setString(3,mm1); rs=pstmt.executeQuery(); } else{ sql=”select User_name,Comm_Name,Buy_List from Buylist where year=? And month=?” ; pstmt=conn.prepareStatement(sql); pstmt.setString(1,year1); pstmt.setString(2,month1); rs=pstmt.executeQuery(); } } else {

















sql=”select User_name,Comm_Name,Buy_List from Buylist where year=?andmonth=? and day=?”;
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,year);
pstmt.setString(2,month) ;
pstmt.setString(3,day);
rs=pstmt.executeQuery();
}
5.2.5 Order information management
The order generated by the user shopping in the foreground cannot be executed immediately, and the system administrator needs to place the order in the background. The running result is shown in Figure 5- 13. An information management review confirms its performance. The user clicks the "Order List" hyperlink in the navigation bar to enter the user's order processing page, which will display the orders that have not been processed in advance, and the operation results are shown in the figure:

Figure 5-19 User order management
The user order processing page displays the basic information of the user. To know the commodities involved in the order, you need to click the hyperlink of the corresponding order number to open the commodity order sheet page. The result of running the product order order is shown in the figure below.

Figure 5-20 Order commodity list
6
System test
6.1 Test and analysis of key parts of the system
After the system is completed, the functions of each module are tested in detail. Compared with the input data and the predicted output data, some problems are found. The main reason is that during the query process, the expected query results are inconsistent with the actual results, and sometimes the purpose is not achieved, and the association between the operation tables of the database is not thoughtful enough, so some small errors often occur. In addition, the inconsistency of the data types before and after the query conditions is also a very common mistake, which needs to be solved step by step. After the assembly of each module is completed, some problems will arise. For example, in the process of operating the shopping cart checkout, due to multiple additions and modifications, and finally checkout, it is easy to cause data confusion. The corresponding data relationship must be clearly understood, and some SQL statements for key query statistics must be carefully considered. to be used in the program.
6.1.1 Unit test analysis
(1) After the above analysis, we can know that the shopping cart module is where we need to pay special attention, because it involves most of the data in our database, and it is the most There must be absolutely no mistakes in the key part. Next, we will conduct a use case test for this module: we
log in to the system as the user fly, the user name is: fly, the password is: 1234,
and then click to order the product: desk lamp 88 yuan
to pop up the shopping cart List: Select the product quantity 2 to confirm.
The list appears: Display the product name. Desk lamp quantity 2 totals 196 yuan,
which is consistent with our estimated data.
At this time, choose to clear the shopping cart, continue shopping, click to order the product: the unit price of Rogue Rabbit is 50 yuan,
select the quantity 3 to confirm, and a list will appear: display the product name Rogue Rabbit, the total is 150 yuan
Continue to select the cash register to checkout, and the bill will show: the product name Rogue Rabbit totals 150 yuan, which is also consistent with our estimated data, which proves that the function of emptying the shopping cart is normal and effective, and the items we purchased for the first time are not included in the calculation. The calculation of the price is also correct.
(2) Test the user registration part.
Username: fly Password: 123456 Confirmation: 123456
Address: 123123213 Gender: Male Category: Member
After submitting, a prompt message pops up: the user already exists, and the user name has been verified repeatedly.
(3) Test the part where the user modifies the password.
User account: fly Original password: 123456
New password: cccc Confirm password: aaaa
After clicking the submit button, first verify that the new password is inconsistent twice, and a prompt message will pop up: the passwords entered twice are different, please re-enter!
Re-enter to make the two passwords the same. If the original password is different from the input data, a prompt message will pop up: The original password is incorrect!
Re-enter the original password: abc A prompt message pops up: Congratulations on successfully changing your password!
(4) Test the added product section.
Commodity number: 101 Commodity name: China Computer Commodity description: Desktop
Commodity type: Brand Commodity price: 3500 Member discount: 3400
After submitting, a prompt message pops up: This product number already exists!
After changing the product number to 112 and submitting, the product is added successfully. Enter the database to check, and the commodity information is written into the database for preservation. Indicates that this function is normal!
The above is the test of the key functions. Use the same method to test and debug each functional module until the function achieves the expected effect.
6.1.2 Summary and description of test analysis
During the testing process, I went through module testing and assembly testing, and ruled out most of the system's errors. Of course, it is impossible to eliminate all errors. I think there should be some errors that are not easy to detect. They need to be further improved in the process of use. Database encryption is an important concept. In the actual application process It is a problem to be solved, and we should do a good job in improving the database, especially the backup and security work; on the other hand, due to the rush of time, it is inevitable that there will be mistakes and imperfections. I hope the teacher can help me give pointers and corrections.

Conclusion
During the few months of graduation project, I experienced the most memorable period in the four years of university, and I gained a lot during this period.
From a technical point of view, through the use of JSP, I have further deepened my knowledge and mastered the establishment, connection and update operations of conventional databases. In the use of JAVA and DreamweaverMX, I have further deepened my understanding of these tools, and the application of SQLServer2005 has also consolidated the results of my study.
More importantly, through this online mall, I learned about the application technology in the whole process management of the online mall. In the understanding of the online mall, that is, e-commerce, I realized that e-commerce is not a simple addition of electronics and commerce, but It is an effective integration of e-commerce and commerce; the combination of e-commerce and commerce does not necessarily result in e-commerce with higher efficiency and effectiveness. On the contrary, if the combination is not good, the efficiency and effectiveness of e-commerce will be even lower. Therefore, it is inappropriate to continue to define e-commerce as "commercial activities through computer networks". The online shopping mall system we designed cannot be a purely independent center of business activities. We need to closely link traditional shopping malls and traditional distribution systems. The definition of e-commerce should be "commercial activities based on and effectively integrated with computer networks".
Due to the short time and limited level of this design, the functions of the website are not perfect, and the security is not high, especially the background functions. Many original settings such as order management modules have not been realized. The value of this design is more suitable for some chained large-scale traditional malls, and can be used as an online window to promote the development of mall business. In the future study and work process, I will further improve, including security verification system, more secure database application, more reasonable delivery management and customer service.

Acknowledgments
Time flies, the sun and the moon fly, and the four years of undergraduate study will soon pass. As the thesis is about to be completed, I sincerely thank all the teachers, classmates and friends who have guided, cared and helped me.
First of all, I would like to thank my supervisor, Associate Professor Zhang Kunao! The research work of this paper was completed under the careful guidance and strict requirements of Mr. Zhang. During the research of the topic and the writing of the thesis, Mr. Zhang gave me a lot of patient guidance and inspiration. Teacher Zhang’s profound knowledge, rigorous academic attitude, professionalism and approachable attitude left a deep impression on me. Under the guidance of Teacher Zhang, I have made a lot of progress in my study and life! He is both a good teacher and a good friend, not only let me learn professional knowledge, but also let me learn a lot of principles of life, he will continue to inspire me to study hard and make progress. These will benefit my life a lot! The teacher's earnest teaching will make me unforgettable all my life. Here, please allow me to express my deep respect and heartfelt thanks.
At the same time, I would also like to thank my classmates and roommates, who have given me great help and support in my study and life.
Finally, I would like to thank all the friends who have given help and concern during the completion of my thesis.

References
[1] http://www.cnhww.com/news.asp?id=72
[2] Wu Yanjun, Huang Feiyue. Proficient in JSP programming technology [M]. People's Posts and Telecommunications Press. 2001.
[3] Nie Xiaoyan .DrwamweaverMX2004 Dynamic Website Construction Raiders [M]. Ordnance Industry Press, Beijing Kehai Electronic Publishing House. 2005. [
4] Xu Guozhi, SQLServer2000 Database System Development Example Essence, Electronic Industry Press, 2006
[5] Feisi Technology Products R&D Center. Detailed Explanation of JSP Application Development [M]. Electronic Industry Press. 2002
[6] Bai Yajun. Collection of JSP Programming Basics and Application Examples [M]. People's Posts and Telecommunications Press. 2001.
[7] Li Jiang, Zhang Wei. Case Analysis XML/XSL/Java Network Programming [M] Beijing Hope Electronics Publishing House 2002
8 MichaelJ.Young, translated by Qianqian Studio. XML Learning Guide [M]. Mechanical Industry Press. 2001.
[9] Liu Tao, SQLServer2000 Database System Development Example Navigation [M], People's Posts and Telecommunications Press, 2004
[10] Li Zhenhua, Ji Xiaowu. Drwamweaver Basic Tutorial [M]. Tsinghua University Press. 2005.
[11] Xiong Xiyi, Dynamic Web Design, Tsinghua University Press [M], 2004
[12] Sai Kuichun. Selected Examples of JSP Information System Development [M]. Mechanical Industry Press. 2006.
13 Damon Hougland, Aaron Tavistock, translated by Ma Zhaohui. JSP Core Technology [M]. Mechanical Industry Press. 2001.
[14]Chaitanya Koratamaddi, Nancy Greenberg. ORACLE Database 10g: SQL D17108GC21 Edition2.1 December 2006 D48183.
[15] Xu Zengwei, Zhang Qiang. JSP rapid and efficient development tool - DrwamweaverUltraDev [M]. Tsinghua University Press. 2002

おすすめ

転載: blog.csdn.net/ambiguous__/article/details/130776665