标签:connector springmvc servlet pom.xml文件 完成后 crud lin 直接 maven
打开ssm-crud项目的pom.xml文件,为其添加<dependencies></dependencies>
标签,在该标签内添加dependency
用的maven,所以在 https://mvnrepository.com 上搜索需要的jar包。
如图:直接搜spring webmvc
选择需要的版本进入,复制其maven信息,放到<dependencies></dependencies>
标签内。
<!-- 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 依赖
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-aspects -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
以上完成了Spring的配置,需要注意的是他们的版本号应该是相同的
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.2</version>
</dependency>
还有mybatis整合spring的适配包,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>
<!-- 数据库连接池、驱动 -->
<!-- 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>
<!-- https://mvnrepository.com/artifact/jstl/jstl -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- 不提供servlet,jsp页面会报错 -->
<!-- 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>
保存完成后,在项目列表里会有Maven Dependecies
里面可以看到所有下载好的jar包
如图:
webapp
文件夹下新建文件夹static
放置下载好的Bootstrap文件、并且新建js
文件夹放置jquery
文件webapp
下新建index.html
<!-- 引入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>
完成后如图:
顺便看看bootstrap样式的按钮长什么样:
END
标签:connector springmvc servlet pom.xml文件 完成后 crud lin 直接 maven
原文地址:https://www.cnblogs.com/famine/p/9782839.html