Introduction of jar package in maven project

Introducing jar package into maven project

  1. Spring
  2. SpringMVC
  3. MyBatis
  4. Database connection pool, driver package
  5. Others (jstl, servlet, junit)

Open the pom.xml file of the SSM crud project, add the < dependencies > < dependencies > tag to it, and add dependency in the tag
Using maven, so in https://mvnrepository.com Search for the required jar package on.

Spring MVC

As shown in the figure: search spring webmvc directly

Select the required version to enter, copy its maven information, and put it in < dependencies > < dependencies >
Inside the label.

<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>4.3.7.RELEASE</version>
</dependency>

Spring jdbc

Similarly, we add Spring jdbc dependency

<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>4.3.7.RELEASE</version>
</dependency>

Aspects

<!-- https://mvnrepository.com/artifact/org.springframework/spring-aspects -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aspects</artifactId>
    <version>4.3.7.RELEASE</version>
</dependency>

After the above configuration of Spring is completed, it should be noted that their version numbers should be the same

MyBatis

<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis</artifactId>
    <version>3.4.2</version>
</dependency>

And the mybatis integration spring adaptation package, MyBatis Spring

<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis-spring</artifactId>
    <version>1.3.1</version>
</dependency>

Database connection pool, driver

  • Search c3p0
<!-- Database connection pool, driver -->
	<!-- https://mvnrepository.com/artifact/com.mchange/c3p0 -->
	<dependency>
	    <groupId>com.mchange</groupId>
	    <artifactId>c3p0</artifactId>
	    <version>0.9.2</version>
	</dependency>
	<!-- mysql -->
	<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
	<dependency>
	    <groupId>mysql</groupId>
	    <artifactId>mysql-connector-java</artifactId>
	    <version>5.1.41</version>
	</dependency>

Others (jstl, servlet, junit)

<!-- https://mvnrepository.com/artifact/jstl/jstl -->
	<dependency>
	    <groupId>jstl</groupId>
	    <artifactId>jstl</artifactId>
	    <version>1.2</version>
	</dependency>
	<!-- Do not provide servlet´╝îjsp The page will report an error -->
	<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
	<dependency>
	    <groupId>javax.servlet</groupId>
	    <artifactId>javax.servlet-api</artifactId>
	    <version>3.0.1</version>
	    <scope>provided</scope>
	</dependency>
	<!-- https://mvnrepository.com/artifact/junit/junit -->
	<dependency>
	    <groupId>junit</groupId>
	    <artifactId>junit</artifactId>
	    <version>4.12</version>
	    <scope>test</scope>
	</dependency>

After saving, there will be Maven dependencies in the project list
You can see all the downloaded jar packages in it
As shown in the picture:

Introduce Bootstrap front-end framework (don't dislike ugly pages, can't be used), and jquery

  • Create a new folder static under the project webapp folder to place the downloaded Bootstrap file , and create a new js folder to place the jquery file
  • Create index.html under webapp
    Add reference:
<!-- Introduce jquery,bootstrap -->
<script type="text/javascript" src="static/js/jquery-1.12.4.js"></script>
<link href="static/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
<script src="static/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>

After completion, as shown in the figure:

By the way, what does a bootstrap style button look like

END

Tags: Spring Mybatis Junit MySQL

Posted on Sun, 15 Dec 2019 08:27:30 -0800 by WDPEjoe