SSM simple project actual combat (basic CRUD operation): quickly learn + complete source code of the project

Foreword: Another year of summer is approaching, looking for an internship? I'm afraid it won't work if I don't have many projects in hand. Today I will bring you a relatively simple Web project. Come and learn!

1. Project introduction

1. Cloud lending library management system

Technology stack: (Spring+SpringMVC+Mybatis+MySql+BootStrap+Jquery)

(The link to the project Lanzuo Cloud is at the end of the article, please take it yourself!)

(The link to the project Lanzuo Cloud is at the end of the article, please take it yourself!)

1. Login confirmation

2. New book recommendation

 

 3. Book borrowing or editing

4. Add new books

 

5. Borrow and view

6. Inquiry about borrowing records

 2. Project Construction

1. Build a database

1. Create a database named cloudlibrary, you can use Navicat to import SQL files, and it will be given in the project!

2. Find the corresponding file and import it to create successfully!

2. Create a JavaEE project

1. Select Tomacat8, and the project name is self-made

 2. The basic structure of the project is shown in the figure

 

 3. Configure the Pom file

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>war</packaging>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.7</version>
                <configuration>
                    <verbose>true</verbose>
                    <overwrite>true</overwrite>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                        <version>8.0.21</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <groupId>com.itheima</groupId>
    <artifactId>cloudlibrary</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <!--Spring核心容器-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.2.8.RELEASE</version>
        </dependency>
        <!--Spring事务管理-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>5.2.8.RELEASE</version>
        </dependency>
        <!--Spring的jdbc操作数据库的依赖,包含Spring自带数据源,jdbcTemplate-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>5.2.8.RELEASE</version>
        </dependency>
        <!--Spring MVC的核心-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.2.8.RELEASE</version>
        </dependency>
        <!--MyBatis核心-->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.2</version>
        </dependency>
        <!--MyBatis的分页插件-->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper</artifactId>
            <version>5.1.10</version>
        </dependency>
        <!--MyBatis整合Spring的依赖-->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>2.0.1</version>
        </dependency>
        <!--mysql数据库驱动-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.16</version>
        </dependency>
        <!--Druid数据源-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.1.20</version>
        </dependency>
        <!--servlet-api :引入servlet的功能-->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
        <!--jsp-api: jsp页面的功能包 -->
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.2</version>
            <scope>provided</scope>
        </dependency>
        <!-- JSTL标签库 -->
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>
        <!--jackson坐标-->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.9.0</version>
        </dependency>


        <!--日志开始-->
        <!--引入日志的门脸-->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.1</version>
        </dependency>
        <!-- 日志工具包 -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.10.0</version>
        </dependency>
        <!--日志核心包-->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.10.0</version>
        </dependency>
        <!--mybatis-dynamic-sql--><!--动态SQL语句类-->
        <dependency>
            <groupId>org.mybatis.dynamic-sql</groupId>
            <artifactId>mybatis-dynamic-sql</artifactId>
            <version>1.1.4</version>
        </dependency>

    </dependencies>

</project>

3. Understand Maven

Maven repository

In Maven terminology, a repository is a place.

The Maven warehouse is a third-party library that the project depends on. The location of this library is called a warehouse.

In Maven, any dependency, plug-in or project build output can be called a component.

The Maven repository helps us manage components (mainly JARs), it is where all JAR files (WAR, ZIP, POM, etc.) are placed.

There are three types of Maven repositories:

  • local
  • central
  • remote

local warehouse

Maven's local warehouse is not created after Maven is installed, it is created when the maven command is executed for the first time.

When running Maven, any artifacts required by Maven are obtained directly from the local repository. If the local warehouse does not have it, it will first try to download the components from the remote warehouse to the local warehouse, and then use the components of the local warehouse.

By default, regardless of Linux or Windows, each user has a warehouse directory named .m2/repository/ under their own user directory.

The Maven local repository is created by default in the %USER_HOME% directory. To modify the default location, define another path in Maven's settings.xml file in the %M2_HOME%\conf directory.

 4. Project link

Self-learning:

SSMProject1.zip - Blue Cloud
 

Remember to like it! !

It's not easy to post, I implore the big guys to raise your hands!


Likes: Likes are a kind of virtue, and they are the recognition of my creation by the bosses!


Comments: There is no white contact, it is the beginning of communication between you and me!


Collection: May you pick more, it is the appreciation of the bosses to me!

Guess you like

Origin blog.csdn.net/m0_55278347/article/details/131158334