码迷,mamicode.com
首页 > 其他好文 > 详细

三、业务开发初步

时间:2016-01-21 23:47:21      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:

一、创建数据库(环境Mysql)

Database Name(略)、Character(UTF-8 Unicode)

二、创建MVC结构

创建java/com.itemname.module(demo)包

包下创建文件夹Controller、Model、Service子包

三、编写Model层

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
}

创建相应的数据库表并插入demo数据

三、编写控制器层

列表界面:GET:/customer

查询动作:POST:/customer_search  --

详情界面:GET:/customer_show?id={id}

新建界面:GET:/customer_create

新建动作:POST:/customer_create

编辑界面:GET:/customer_edit?id={id}

编辑动作:PUT:/customer_edit?id={id}

删除动作:DELETE:/customer_delete?id={id}

对应5个Servlet

CustomerServlet、CustomerShowServlet、CustomerCreateServlet、CustomerEditServlet、CustomerDeleteServlet

创建Servlet。

@WebServlet("/customer_create")
public class CustomerCreateServlet extends HttpServlet {
/**
* 处理 创建客户 请求
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//TODO
}

/**
* 进入 创建客户 界面
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//TODO
}
}

四、编写服务层

public class CustomerService {
/**
* 获取客户列表
*/
public List<Customer> GetCustomerList(String keyword) {
//TODO
return null;
}
/**
* 获取客户
*/
public Customer GetCustomer(long id){
//TODO
return null;
}
/**
* 创建客户
*/
public boolean CreateCustomer(Map<String,Object> fieldMap){
//TODO
return false;
}
/**
* 更新客户
*/
public boolean UpdateCustomer(long id, Map<String,Object> fieldMap){
//TODO
return false;
}
/**
* 删除客户
*/
public boolean DeleteCustomer(long id){
//TODO
return false;
}
}

三、业务开发初步

标签:

原文地址:http://www.cnblogs.com/olapforever/p/5149821.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!