Third, the initial business development

Source: Internet
Author: User

I. Create a database (environment MySQL)

Database Name (abbreviated), Character (UTF-8 Unicode)

Ii. Creating an MVC structure

Create a Java/com.itemname.module (demo) package

Create folder under Package Controller, Model, service child package

III. preparation of the model layer

New Java Class:customer

public class Customer {
Private long CustomerID;
Private String Name;
Private String contact;
Private String telephone;
Private String Email;
Private String Remark;

Getter and Setter
}

Create the appropriate database table and insert the demo data

Third, write the controller layer

List interface: Get:/customer

Query action: Post:/customer_search--

Detail interface: Get:/customer_show?id={id}

New interface: Get:/customer_create

New action: Post:/customer_create

Editing interface: Get:/customer_edit?id={id}

Edit action: Put:/customer_edit?id={id}

Delete action: Delete:/customer_delete?id={id}

Corresponds to 5 servlets

Customerservlet, Customershowservlet, Customercreateservlet, Customereditservlet, Customerdeleteservlet

Create a servlet.

@WebServlet ("/customer_create")
public class Customercreateservlet extends HttpServlet {
/**
* Process Create customer request
*/
protected void DoPost (HttpServletRequest request, httpservletresponse response) throws Servletexception, IOException {
Todo
}

/**
* Enter Create customer interface
*/
protected void doget (HttpServletRequest request, httpservletresponse response) throws Servletexception, IOException {
Todo
}
}

Iv. preparation of the service layer

public class CustomerService {
/**
* Get Customer List
*/
Public list<customer> getcustomerlist (String keyword) {
Todo
return null;
}
/**
* Get Customer
*/
Public Customer GetCustomer (long id) {
Todo
return null;
}
/**
* Create Customer
*/
public boolean CreateCustomer (map<string,object> fieldMap) {
Todo
return false;
}
/**
* Update Customer
*/
public Boolean UpdateCustomer (long ID, map<string,object> fieldMap) {
Todo
return false;
}
/**
* Delete Customer
*/
public Boolean deletecustomer (long id) {
Todo
return false;
}
}

Third, the initial business development

Related Article

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.