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
At present, limited by technological innovation and application level, the development of e-commerce in enterprises is still in its infancy. With the improvement of these two aspects and the development of other related technologies, e-commerce will advance in depth, and a new generation of e-commerce will emerge to replace the current simple trust "website + email". E-commerce companies will transition from the primary form of online stores and portals to extending their core business processes and customer relationship management to the Internet, making products and services closer to user needs. Interaction and real-time have become the common characteristics of enterprise information exchange, and the network has become the central nerve of enterprise resource planning, customer relationship management and supply chain management. Enterprises will create and form new value chains, unite new, old, upstream and downstream stakeholders, form more efficient strategic alliances, and jointly seek greater benefits.
(2) E-commerce will penetrate rapidly into all walks of lifeThe
advocates of e-commerce are the world's giants of IT industry IBM, HR, Microsoft, the implementation of e-commerce is firstly the financial service industry (including banking system, stock trading systems, insurance systems, and service companies such as Amazon for book sales), followed by large multinational companies (such as DELL, General Motors, under the condition that there are few large multinational companies in China, the giants of China’s home appliance industry, Chunlan, Haier, TCL, etc. are actively promoting e-commerce plans), and then the traditional processing and manufacturing industries, retail enterprises and small and medium-sized enterprises, so as to realize the grafting and transformation of e-commerce to traditional industries, retail industries and small and medium-sized enterprises. Finally, it will be extended to public utilities such as government departments, military departments, medical and health departments, and education departments. The current situation of e-commerce in our country is that the financial industry has been fully developed and continues to deepen; other service industries have not yet entered this field; large enterprises have just begun to enter and need further development; Future development will be to the constant needs of these industries. With China's accession to the WTO, e-commerce will penetrate into all walks of life in the country. This is an inevitable and only choice for our country, and it is also an inevitable and only choice that all walks of life in our country can make. The economy is also a serious challenge.
(3) The geographical scope of e-commerce will expand rapidly
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) It is convenient to collect reader information and provide readers with personalized services. According to the information of readers' browsing and purchasing, analyze readers' reading interests, and directly recommend relevant products or send regular emails to readers when they visit again.
(5) The variety scale is large, the operation time is long, and the shelf life is long. Generally, in a traditional large-scale bookstore, there are no more than 200,000 varieties of goods, and online shopping malls can theoretically have an infinite number of varieties. "The Internet is not closed", as long as the server is working normally, netizens can search and order products without time constraints.
Operate without borders. As long as you know the domain name, you can visit it all over the world without space restrictions.
2.2 Introduction to related implementation technologies
2.2.1 JSP language and its characteristics Adding Java program fragments (Scriptlet) and JSP tags (tag)
to traditional web page HTML files ( .htm, .html) constitutes a JSP web page (*.jsp ). JSP pages look like standard HTML and XML pages, with additional elements that the JSP engine can process and extract.
When the web server encounters a request to access a JSP web page, it first executes the program fragments in it, and then returns the execution result to the user in HTML format.
Program fragments can operate databases, redirect web pages, and send E-mails, etc., which are the functions needed to build dynamic websites.
All programs are executed on the server side, and only the results are sent to the client on the network, and the requirements for the client's browser are the lowest. It is based on the powerful Java language, has good scalability, and has unique advantages in the field of network database application development.
JSP technology accelerates the development of dynamic Web pages in several ways:

  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. Intuitive new workspace
    Save valuable development time with tabbed document windows, dockable panel groups, customizable toolbars, and integrated file browsing.
  8. More Powerful Templates
    Set up sophisticated rules for distributors to enter content without compromising site design. Nested templates enable more custom layout control, while editable and selectable regions allow more flexibility for distributors to enter content.
  9. Extensive code library
    Create insert and update forms, recordset navigation pages, and user authentication pages using the pre-built code library. Test the layout by populating the design view with live data.
  10. New server technology support
    DreamweaverMX has added support for building ColdFusionMX, ASP.NET and PHP websites, as well as support for developing ASP, JSP and traditional ColdFusion applications.
  11. Sample content to get you started
    Leverage professional-quality, pre-built layouts and code, including site structure, forms, accessible templates, and JavaScript client-side interactions. Create new sites quickly with the Site Setup Wizard that instantly configures site information for dynamic sites, static sites, or ISP-hosted sites.
  12. XML and Web Standards Support
    Stay on the leading edge with XML support, including editing, validating and importing schemas. Easily introspect XML-based web services in ColdFusion, .NET, and Java. Ensure standards compliance with default creation of XHTML output and simple conversion of standard HTML to XHTML.
  13. Improved Cascading Style Sheets 2 (CSS2) support
    Use the improved CSS rendering and design tools in DreamweaverMX to build sites that comply with the latest CSS standards. The DreamweaverMXCSS panel has been enhanced to display styles defined internally and externally, and supports design-time-only stylesheets.
  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 is the abbreviation of the Java Database Connection (JavaDataBaseConnectivity) technology developed by the developer of Java—Sun's Javasoft company. It is a technology that provides seamless connection for various commonly used databases. The role of JDBC in Web and Internet applications is similar to that of ODBC in Windows series platform applications. ODBC (OpenDataBaseConnectivity), known as open database interconnection technology, is a database connection technology advocated by Microsoft and widely responded by the industry. If readers have experience in ODBC programming, they will find that JDBC is very similar to ODBC. The databases that JDBC can now connect to include: xbase, Oracle, Sybase, Aceess, and Paradox.
    If the user is engaged in the software field, it is impossible not to have heard of SQL (Structure Query Language: Structured Query Language), which is a standardized relational database access language. From the perspective of SQL, a database is a collection of tables, which contain rows and columns. Although the SQL standard is still in constant change (if any standard has become static, it can only show that this subject has stopped developing), but its basic content is relatively stable. JDBC defines the programming interface between Java language and SQL data.
    JDBC has a very unique dynamic connection structure, which makes the system modular. Using JDBC to complete the access to the database includes the following four main components: Java application, JDBC driver manager, driver and data source.
    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.

Figure 2-1 Schematic diagram of B/S architecture
This structure not only liberates the client from the heavy burden and continuously improving performance requirements, but also liberates the technical maintenance personnel from the heavy maintenance and upgrading work. Since the client assigns the transaction processing logic part to the functional server, the client is suddenly "slim" a lot, and is no longer responsible for complex calculations and data access and other key tasks, but only for the display part, so the maintenance personnel are no longer responsible for the program. The maintenance work runs between each client, and the main focus is on the update of the program on the functional server. This three-layer structure is independent from layer to layer, and changes in any layer will not affect the functions of other layers.
2.3.2 MVC-based application development model
In traditional Web-based application systems, such as ASP, CGI, etc., developers usually mix business logic, data logic, display logic, etc. in the same interface. The access and operation of the background database also includes business processes and page presentation. The program written in this way is not conducive to the debugging of business code by programmers, and is also not conducive to the design of interactive pages by editors. At the same time, the system is not scalable. When we want to expand on the existing business, we usually cannot use the existing resources and applications, but can only rewrite it, which greatly increases the investment and prolongs the time for the system to go online. , lost the advantage of the competitive market.
In this online shopping system, the popular MVC model will be used to build applications. This structure solves all the problems mentioned above. In our application integration network, the MVC development model is realized through the enterprise-level high-end J2EE application server. The logic diagram of MVC is as follows:

Figure 2-2 Logical diagram of development using MVC on the application server

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.
Therefore, enterprises need to re-understand the market, consumers and their own market positioning, correctly understand the important position of e-commerce technology in enterprises, and use a small amount of time and funds to establish enterprise information portals and set up a certain range of business networks. The long-term development strategy makes the economic activities between enterprises and customers more flexible and active.
4
Overall Design
4.1 Project Overall Design
4.1.1 Design Ideas
Online shopping mall is a brand-new sales method. With the popularization of the Internet, new technologies emerge in an endless stream, and the security of online transactions is continuously improved. The development has laid a good foundation. Because this kind of commodity is easy to store, convenient to distribute, and has high security during transportation. In addition, commodity information can be displayed to users more intuitively and truly on the Internet than other commodities, and the discount rate is also high. The mall is relatively prosperous.
When we develop an online shopping mall system, we must first start from the customer's point of view, provide a good user interface, and use humanized design as much as possible in the layout and function design of the website to make users feel friendly and attract customers visually. Provide convenient and quick operation functions, so that users of any knowledge level can quickly use the shopping system proficiently. Provide a powerful retrieval system to quickly retrieve all information in the station. It can quickly and accurately display all product information according to the user's requirements, and can be easily added to the shopping cart. Improve the security of the website and the readiness of information, ensure the confidentiality of personal shopping information, and strengthen the security of the user's shopping process. Provide modification of product information in the shopping cart, and place an order after confirmation. Provide a secure online payment method and a comprehensive and timely distribution method.
4.1.2 Overall framework design
The e-commerce system is a typical JSP database development application program, which consists of two parts: front-end product display and sales, and back-end management.

  1. Product display and sales at the front desk:
    This part mainly includes special offers, sales rankings, shopping carts, member management, product announcements, viewing shopping carts, product inquiries, etc.
  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] When the user clicks the button, I will buy these, and I need to judge Whether the inventory quantity of the product is sufficient, if the quantity that the user wants to buy is greater than the quantity of the commodity in stock, a prompt will pop up, and if the quantity that the user wants to buy is less than the quantity of the commodity in stock, then the sum of the total consumption of each commodity will be calculated. The key code is as follows: 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;//remaining quantity of goods 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"/
<%
}
at the right of each commodity in the commodity list There is a hyperlink "Modify" on the square, and when clicked, the system will open the modify product information page, which is mainly used for product information modification to facilitate the administrator to update and modify each product information. The running result of the directory modification page is shown in the figure.
[10]
5-14 Modify product information
In order to reduce errors, it is necessary to verify the legitimacy of the data when submitting. The price of the product entered cannot be empty, the product name cannot be empty, and the preferential price of the product cannot be higher than The original price of the commodity, these tasks can be written by the script language Javascript, here is to use the script language function check () to complete.
When the submit button is clicked, the information in the database will be updated, and the product number cannot be modified. The administrator can modify the selling price of the product and the discounted price of the product to achieve the modification and update of the product information.
There is a hyperlink of "commodity sales query" in the left navigation area, and the system will open the commodity sales query page. The monthly sales situation, this function can easily let the administrator know the sales situation of the product, which is very helpful for the administrator to purchase the goods, this function can quickly understand which product has the best sales recently , which heavy product sales are poor, so that the administrator knows what goods to buy in the near future are good for sales, and what to buy is not good for sales. The product sales query results are shown in the figure.

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

Guess you like

Origin blog.csdn.net/ambiguous__/article/details/130776665