learning target
- (1) Project construction
- (2) Core module: login
- (3)sql
- (4) Junit
- (5) Git
Preparing to work project presentation
Familiar with static pages.
View real online Tuniu tourism project.
Actually it is just a mall. Key project construction. Core module: Login
Preface
- (1) Preface
In order to consolidate the basic knowledge of the web and improve the comprehensive application ability, this case is explained.
It is required that each student can complete this case independently. - (2) Project Demonstration
01-Static page
allows customers to visually see the effect of project completion - (3) Copy to project Copy
new web-app
to project
Start
Preparatory work three-tier architecture
- (1) Three-tier architecture
Preparatory work technology selection
- (1) Web layer
a) Servlet: front controller
b) html: view
c) Filter: filter
d) BeanUtils: data encapsulation
e) Jackson: json serialization tool - (2) Service layer
f) Javamail: java sending mail tool
g) Redis: nosql memory database
h) Jedis: java redis client - (3) Dao layer
i) Mysql: database
j) Mybatis: package jdbc
pom.xml dependency
<dependencies>
<!-- junit-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!--servlet-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- MySql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
</dependency>
<!-- Mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.5</version>
</dependency>
<!--日志包-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!--beanUtils-->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.2</version>
<scope>compile</scope>
</dependency>
<!--jackson-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.3.3</version>
</dependency>
<!--javaMail-->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.3</version>
</dependency>
<!--jedis-->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.7.0</version>
</dependency>
</dependencies>
Preparation to create the database
-- 创建数据库
create database lvyou;
-- 使用数据库
use lvyou;
-- 创建表
复制提供好的sql
Build Mybatis
Copy four important files:
core configuration file,
mapping file,
log file,
tool class MySessionUtil