SSM-CRUD整合项目 |基础环境搭建


如果创建项目报错,可以参照《使用eclipse创建Web工程》
如果Maven配置出现问题,可以参照《使用Maven配置阿里云镜像与JDK》

一、创建Maven工程

在Eclipse中创建一个简单的Maven工程,记得将打包方式设置为war包方式。

在这里插入图片描述

引入项目依赖包

项目中使用到的jar包说明使用版本坐标
pageHelper分页插件5.0.0地址
mybatis-generator-coremybatis的逆向工程1.3.5地址
spring-webmvc包含SpringMVC框架相关的所有类。4.3.7地址
jackson-databind是基于Java平台的一套数据处理工具,可以进行Java Json解析。2.8.8地址
hibernate-validatorJSR303数据校验支持(tomcat7以下的服务器需要额外替换el表达式)5.4.1地址
spring-jdbc对JDBC 的简单封装4.3.7地址
spring-aspectsSpring提供的对AspectJ框架的整合4.3.7地址
spring-test对JUNIT等测试框架的简单封装4.3.7地址
mybatismybatis依赖3.4.2地址
mybatis-springmybatis与spring整合1.3.1地址
c3p0C3P0是一个开源的连接池。0.9.1地址
mysql-connector-javaMySQL数据库驱动。5.1.41地址
jstljstl依赖1.2地址
javax.servlet-api注意:此jar包推荐设置为provided,避免与tomcat中的servlet冲突。3.0.1地址
junit测试使用的依赖4.12地址

本项目完整pom文件如下,详细内容可参照上表:

<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>
	<groupId>com.gql</groupId>
	<artifactId>ssm-crud</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>

	<dependencies>
		<!-- SpringMVC、Spring -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>4.3.7.RELEASE</version>
		</dependency>

		<!-- Spring AOP -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aspects</artifactId>
			<version>4.3.7.RELEASE</version>
		</dependency>

		<!-- Spring test -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>4.3.7.RELEASE</version>
			<scope>provided</scope>
		</dependency>

		<!-- Mybatis -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.4.2</version>
		</dependency>

		<!-- Mybatis整合Spring的适配包 -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>1.3.1</version>
		</dependency>

		<!-- mybatis的逆向工程MBG -->
		<dependency>
			<groupId>org.mybatis.generator</groupId>
			<artifactId>mybatis-generator-core</artifactId>
			<version>1.3.5</version>
		</dependency>

		<!-- pageHelper分页插件 -->
		<dependency>
			<groupId>com.github.pagehelper</groupId>
			<artifactId>pagehelper</artifactId>
			<version>5.0.0</version>
		</dependency>


		<!-- 数据处理工具:可以返回Json字符串的支持 -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.8.8</version>
		</dependency>

		<!-- 后端校验:hibernate的JSR303 -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-validator</artifactId>
			<version>5.4.1.Final</version>
		</dependency>

		<!-- Spring Jdbc -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>4.3.7.RELEASE</version>
		</dependency>

		<!-- mysql数据库驱动 -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.41</version>
		</dependency>

		<!-- c3p0数据库连接池 -->
		<dependency>
			<groupId>c3p0</groupId>
			<artifactId>c3p0</artifactId>
			<version>0.9.1</version>
		</dependency>

		<!-- jstl依赖 -->
		<dependency>
			<groupId>jstl</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>

		<!-- servlet-api,需要设置为provided,避免与tomcat冲突 -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.0.1</version>
			<scope>provided</scope>
		</dependency>

		<!-- junit测试依赖 -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>provided</scope>
		</dependency>

	</dependencies>
</project>

三、引入Bootstrap框架和jQuery

本项目使用Bootstrap3.3.7版本,下载Bootstrap框架请前往:Bootstrap官网
在webapp文件夹下创建一个static文件夹,引入Bootstrap框架后,再创建js文件夹,引入jQuery文件(这个需要自行下载)。
在这里插入图片描述

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>员工列表</title>
		<%
			pageContext.setAttribute("APP_PATH", request.getContextPath());
		%>
		<script 
			src="${APP_PATH }/static/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
		
		<link
			href="${APP_PATH }/static/bootstrap-3.3.7-dist/css/bootstrap.min.css"
			rel="stylesheet">
			
		<script type="text/javascript"
			src="${APP_PATH }/static/js/jQuery-3.4.1.js"></script>
	</head>
	
	<body>
	
	</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Hudie.

不要打赏!不要打赏!不要打赏!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值