开发者学堂课程【Java Web项目实战2:图书商城:用户模块之创建相关类】学习笔记,与课程紧密联系,让用户快速学习知识。
课程地址:https://developer.aliyun.com/learning/course/35/detail/764
用户模块之创建相关类
1. domain:User
2. dao: UserDao
3. service: UserDao
4. web.servlet:Userservlet
一:User
1.
package cn.itcast.bookstore.user.domain;
2.
/**
3.
*User的领域对象
4.
*@author cxf
5.
*
6.
*/
7.
public class User {
8.
/*
9.
对应数据库表
10.
*/
11.
private String uid;//主键
12.
private String username;//用户名
13.
private String password;//密码
14.
private String email;//邮箱
15.
private String code;//激活码
16.
private boolean state;//状态(已激活和未激活)
二:UserDao
1.
package cn.itcast.bookstore.user.d
ao
;
2.
/**
3.
*User持久层
4.
*@author cxf
5.
*
6.
*/
7.
public class UserDao {
8.
private QueryRunner qr = new TxQueryRunner();
9.
}
三:UserService
1.
package cn.itcast.bookstore.user.service;
2.
import cn.itcast.bookstore.user.dao.UserDao;
3.
/**
4.
*User业务层
5.
*@author cxf
6.
*
7.
*/
8.
public class UserService {
9.
private UserDao userDao = new UserDao();
10.
}
四:Userservlet
1.
package cn.itcast.bookstore.user.web.servlet;
2.
import cn.itcast.bookstore.user.service.Userservice;
3.
import cn.itcast.servlet.Baseservlet;
4.
/**
5.
*User表述层
6.
*/
7.
public class UserServlet extends BaseServlet {
8.
private UserService userService = new UserService();
9.
}