The demand analysis of Javaweb online Mall project

Source: Internet
Author: User

Follow a video tutorial practiced hand project. Not very detailed, because the focus is on the development of skills, but roughly the same

I. Requirements DETERMINATION
    • Users Browse Products
    • Users Search for products
    • User Registration Membership
    • Member Price System
    • Shopping Cart
    • Member Self-service management
    • Admin background management (including personnel, product management)
Two. Architecture Analysis Design

Logical architecture

    • Jsp+javabean+database
    • JSP is responsible for performance
    • JavaBean Responsible for logic
    • Database is responsible for persistent data retention

Software Environment

    • Development tools IntelliJ Idea
    • Tomcat 8.0
    • mysql5.5
Three. Business logic

Class

    • Membership Category – Packaging system membership, one-to-many relationship with order class
    • Administrator Class – Packaging system administrator
    • Product Category – Packaging product information, many-to-many relationships with orders
    • Category categories – Packaged product categories, tree-like structure, and product-to-one
    • Order class – Packing order information, many-to-many products, and members of a
    • Shopping Cart category – Packaged shopping cart information, with product-to-one

Specific parameters and functions are later added with UML

Four, database design
create  table  user  (ID int  primary  key  auto_increment,//primary key automatically increments username varchar  ( 40 ),//user name 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 , #pid为 0  is the topmost node name varchar  (255  ), Descr varchar  (255 ), CNO int , #最多三层, two bits per layer, up to 99  child node grade int  #代表级别, 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,//on 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  unhandled single 1  processing order 2  scrap order);   
create table salesitem (id int primary key auto_increment,productid int, //产品idunitprice double, //单价pcount int,orderid int references salesorder(id)//外键);
Five, interface design

Front desk

    • Home index.jsp
    • Search Interface search.jsp
    • Search results for searchresult.jsp
    • Register register.jsp
    • Registration failed registererr.jsp
    • Registration Successful REGISTEROK.JSP
    • Login login.jsp
    • Login successful loginok.jsp
    • Logon Failure loginerr.jsp
    • Self Service selfservice.jsp
    • Shopping Cart car.jsp
    • Checkout buy.jsp

Background

    • Login login.jsp
    • Home index.jsp
    • User management (display, delete, search)
    • Product management (Increase and deletion of search)
    • Category management (increase and deletion of search)
    • Order View salesorderlist.jsp
    • Order Processing salesorderdeal.jsp
Six, the development process

V0.1 Write user First
V0.2 in writing classification
V0.3 then the product
V0.4 Next Shopping
V0.5 Final Order Processing
V0.6 Other Features

Seven. Create a basic project

Executes the SQL statement, establishes the table, and then builds the Javaweb project to create COM. SqlHelper package, creating the SqlHelper class for connecting to the database

SqlHelper Source Code

 PackageCom. SQLhelper;Importjava.sql.*;/** * Created by nl101 on 2016/2/1. * * Public  class SQLHelper {    //Initialize Method    PrivateConnection conn =NULL;PrivatePreparedStatement PS =NULL;PrivateResultSet rs =NULL;PrivateString Driverurl ="Com.mysql.jdbc.Driver";PrivateString URL ="Jdbc:mysql://localhost:3306/bbs";PrivateString username ="Root";PrivateString Password ="7946521";/** * Initialize Conn connection * /     Public SQLHelper(){Try{Class.forName (Driverurl);        conn = Drivermanager.getconnection (Url,username,password); }Catch(ClassNotFoundException e)            {E.printstacktrace (); System.err.println ("Drive failed to load"); }Catch(SQLException e)            {E.printstacktrace (); System.err.println ("Database connection Failed"); }    }/** * Database update * @param SQL SQL statement * @param params additional parameter * @return True update succeeded, Fals E update failed * /     Public Boolean Update(String sql,string[] params) {intK =0;Try{PS = conn.preparestatement (SQL); for(inti =0; i < params.length; i++) {ps.setstring (i+1, Params[i]);        } k = Ps.executeupdate (); }Catch(SQLException e)            {E.printstacktrace (); System.err.println ("Update Failed"); }returnK >0; }/** * Database update * @param SQL SQL statement * @return True update succeeded, false update failed */     Public Boolean Update(String SQL) {intK =0;Try{PS = conn.preparestatement (SQL);        K = Ps.executeupdate (); }Catch(SQLException e)            {E.printstacktrace (); System.err.println ("Update Failed"); }returnK >0; }/** * Query function * @param SQL query statement * @param params additional parameter * @return return query result set */< /c6>     PublicResultSetQuery(String sql,string[] params) {Try{PS = conn.preparestatement (SQL); for(inti =0; i < params.length; i++) {ps.setstring (i+1, Params[i]);        } rs = Ps.executequery (); }Catch(SQLException e)            {E.printstacktrace (); System.err.println ("Query Failed"); }returnRs }/** * Query function * @param SQL query statement * @return return query result set * *     PublicResultSetQuery(String SQL) {Try{PS = conn.preparestatement (SQL);        rs = Ps.executequery (); }Catch(SQLException e)            {E.printstacktrace (); System.err.println ("Query Failed"); }returnRs }/** * 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  * *     PublicConnectionGetconn() {returnConn }}

The next article begins to write the user class

The demand analysis of Javaweb online Mall project

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.