JavaWeb完整案例详细步骤

JavaWeb完整案例详细步骤废话少说,展示完整案例

JavaWeb完整案例详细步骤

文章插图
代码的业务逻辑图
JavaWeb完整案例详细步骤

文章插图
主要实现功能基本的CURD、分页查询、条件查询、批量删除
所使用的技术
  • 前端:Vue+Ajax+Elememt-ui
  • 后端:Web层(Servlet)+Service层+Dao层(持久层)+Mybatis
步骤:第一步:创建项目、导入jar包、创建数据库、Element-ui、Axios框架
  • pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">  <modelVersion>4.0.0</modelVersion>  <groupId>com.wfy</groupId>  <artifactId>BrandTest</artifactId>  <packaging>war</packaging>  <version>1.0-SNAPSHOT</version>  <name>BrandTest Maven Webapp</name>  <url>http://maven.apache.org</url>  <dependencies>    <dependency>      <groupId>junit</groupId>      <artifactId>junit</artifactId>      <version>4.13.2</version>      <scope>test</scope>    </dependency><!-- servlet-->    <dependency>      <groupId>javax.servlet</groupId>      <artifactId>javax.servlet-api</artifactId>      <version>4.0.1</version>    </dependency><!--mysql-->    <dependency>      <groupId>mysql</groupId>      <artifactId>mysql-connector-java</artifactId>      <version>8.0.30</version>    </dependency><!-- ajax-->    <dependency>      <groupId>com.alibaba</groupId>      <artifactId>fastjson</artifactId>      <version>2.0.14</version>    </dependency><!--mybatis-->    <dependency>      <groupId>org.mybatis</groupId>      <artifactId>mybatis</artifactId>      <version>3.5.11</version>      <scope>compile</scope>    </dependency>  </dependencies>  <build>    <finalName>BrandTest</finalName>  </build></project>?
  • mybatis-config.xml
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE configuration        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"        "http://mybatis.org/dtd/mybatis-3-config.dtd"><configuration>?    <!--起别名-->    <typeAliases>        <package name="com.wfy.pojo"/>    </typeAliases>    <environments default="development">        <environment id="development">            <transactionManager type="JDBC"/>            <dataSource type="POOLED">                <property name="driver" value="https://www.huyubaike.com/biancheng/com.mysql.jdbc.Driver"/>                <property name="url" value="https://www.huyubaike.com/biancheng/jdbc:mysql:///test?useSSL=false&useServerPrepStmts=true"/>                <property name="username" value="https://www.huyubaike.com/biancheng/root"/>                <property name="password" value="https://www.huyubaike.com/biancheng/root"/>            </dataSource>        </environment>    </environments>    <mappers>        <!--扫描mapper-->        <package name="com.wfy.mapper"/>    </mappers></configuration>

经验总结扩展阅读