Demand Analysis of javaWEB online mall project

Source: Internet
Author: User

Demand Analysis of javaWEB online mall project

I followed a video tutorial to train my hands on the project. It was not very detailed, because the focus was on learning development skills, but it was roughly the same.

I. requirements determine users browse products users search products users register members membership price system shopping cart members self-service management administrator background management (including personnel and commodity management) II. Architecture Analysis and Design

Logical architecture

JSP + JavaBean + Database JSP is responsible for displaying JavaBean, responsible for logical Database, and persistent data persistence

Software Environment

Development Tool intellij idea Tomcat 8.0 mysql5.5 3. Business Logic

Class

Members-Members of the packaging system, one-to-many relationship with the order type administrator class-Packaging System Administrator product class-Packaging product information, and orders many-to-many relationship categories-Packaging product category, tree structure, with product many to one order class-packaging order information, and product many to many, with Members many to one shopping cart class-packaging shopping cart information, and product many to one

The specific parameters and functions will be supplemented with UML later.

Iv. Database Design
Create table user (id int primary key auto_increment, // username varchar (40), // username password varchar (16), // password phone varchar (40 ), addr varchar (255), rdate datetime // registration date );
Create table category (id int primary key auto_increment, pid int, # If the pid is 0, the top-level node name varchar (255), descr varchar (255), cno int, # A maximum of three layers, two layers, and a maximum of 99 sub-nodes, grade int #, representing the level, starting from 1 );
Create table product (id int primary key auto_increment, name varchar (255), // product name descr varchar (255), // description normalprice double, // market price memberprice double, // member price pdate datetime, // cabinet date categoryid int references catetory (id) // Foreign key );
Create table salesorder (id int primary key auto_increment, userid int, addr varchar (255), odate datetime, // order time status int // 0 unprocessed single 1 processed single 2 waste single );
Create table salesitem (id int primary key auto_increment, productid int, // product idunitprice double, // unit price pcount int, orderid int references salesorder (id) // Foreign key );
V. Interface Design

Front-end

Home index. jsp search interface search. jsp search result searchresult. register in jsp. registererr. jsp registration successful registerok. jsp login. loginok is successfully logged on to jsp. loginerr. jsp self-service selfservice. jsp shopping cart car. jsp checkout buy. jsp

Background

Log on to login. jsp homepage index. jsp user management (display, delete, search) Product Management (add, delete, modify, query) Category Management (add, delete, modify, query) Order browsing salesorderlist. jsp order processing salesorderdeal. jsp 6, Development Process

V0.1 users first
V0.2 in write category
V0.3 and Product
V0.4 next shopping
V0.5 final order processing
Other V0.6 Functions

7. Create a basic project

Execute the SQL statement, create a table, create a javaWEB project, create the com. SQLHelper package, and create the SQLHelper class for connecting to the database.

SQLHelper source code

Package com. SQLhelper; import java. SQL. *;/*** Created by nl101 on 2016/2/1. */public class SQLHelper {// initialization method private Connection conn = null; private PreparedStatement ps = null; private ResultSet rs = null; private String driverURL = "com. mysql. jdbc. driver "; private String URL =" jdbc: mysql: // localhost: 3306/bbs "; private String username =" root "; private String password =" 7946521 "; /*** initialize conn Connect */public SQLHelper () {try {Class. forName (driverURL); conn = DriverManager. getConnection (URL, username, password);} catch (ClassNotFoundException e) {e. printStackTrace (); System. err. println ("failed driver loading");} catch (SQLException e) {e. printStackTrace (); System. err. println ("database connection failed");}/*** database update * @ param SQL statement * @ param params additional parameter * @ return true update successful, false update failed */public boolean update (String SQL, String [] params) {int k = 0; try {ps = conn. prepareStatement (SQL); for (int I = 0; I <params. length; I ++) {ps. setString (I + 1, params [I]);} k = ps.exe cuteUpdate ();} catch (SQLException e) {e. printStackTrace (); System. err. println ("update failed");} return k> 0;}/*** database update * @ param SQL statement * @ return true update successful, false update failed */public boolean update (String SQL) {int k = 0; try {ps = conn. prepareStat Ement (SQL); k = ps.exe cuteUpdate ();} catch (SQLException e) {e. printStackTrace (); System. err. println ("update failed");} return k> 0 ;} /*** query function ** @ param SQL query statement * @ param params additional parameter * @ return returns the query result set */public ResultSet query (String SQL, String [] params) {try {ps = conn. prepareStatement (SQL); for (int I = 0; I <params. length; I ++) {ps. setString (I + 1, params [I]);} rs = ps.exe cuteQuery ();} catch (SQ LException e) {e. printStackTrace (); System. err. println ("query failed");} return rs ;} /*** query function * @ param SQL query statement * @ return returns the query result set */public ResultSet query (String SQL) {try {ps = conn. prepareStatement (SQL); rs = ps.exe cuteQuery ();} catch (SQLException e) {e. printStackTrace (); System. err. println ("query failed");} return rs;}/*** close database connection */public void close () {try {if (rs! = Null) rs. close (); rs = null; if (ps! = Null) ps. close (); ps = null; if (conn! = Null) conn. close (); conn = null;} catch (SQLException e) {e. printStackTrace () ;}/ *** get link * @ return */public Connection getConn () {return conn ;}}

The next article begins to write the user class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.