SSM+JSP+Bootstrap+Ajax小实例(员工CRUD系统)(一:项目的初始化搭建)

        最近一直在用springboot,突然发现对SSM已经基本忘光了。。毕竟以前也是哪里不会查哪里,没有系统的细致的研究,正好最近有时间,结合网上的各种示例自己系统的搞出一个员工CRUD系统出来,整合了SSM+JSP+Bootstrap+Ajax。好了,话不多说,进入正题。

        首先我们用eclipse创建一个Maven项目,名字叫ssm-crud,然后我们再pom.xml里加上一些我们必须的包,如下所示(后期我们如果需要别的包我们会往里再添加),其中的build是配置maven默认的java版本,如果不写这个你在buildpath里把java版本更新后可能会报错。

<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.sunsy</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>
	
	<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
	<dependency>
	    <groupId>org.springframework</groupId>
	    <artifactId>spring-jdbc</artifactId>
	    <version>4.3.7.RELEASE</version>
	</dependency>
	
	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-aspects</artifactId>
		<version>4.3.7.RELEASE</version>
	</dependency>

	
	<!-- 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/c3p0/c3p0 -->
	<dependency>
	    <groupId>c3p0</groupId>
	    <artifactId>c3p0</artifactId>
	    <version>0.9.1.2</version>
	</dependency>
	
	<!-- 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/org.mybatis/mybatis -->
	<dependency>
	    <groupId>org.mybatis</groupId>
	    <artifactId>mybatis</artifactId>
	    <version>3.4.2</version>
	</dependency>
 
	<!-- https://mvnrepository.com/artifact/jstl/jstl -->
	<dependency>
	    <groupId>jstl</groupId>
	    <artifactId>jstl</artifactId>
	    <version>1.2</version>
	</dependency>
 
	<!-- 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>
	
 	<!-- https://mvnrepository.com/artifact/org.mybatis.generator/mybatis-generator-core -->
	<dependency>
	    <groupId>org.mybatis.generator</groupId>
	    <artifactId>mybatis-generator-core</artifactId>
	    <version>1.3.5</version>
	</dependency>
	
	<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
	<dependency>
	    <groupId>org.springframework</groupId>
	    <artifactId>spring-test</artifactId>
	    <version>4.3.7.RELEASE</version>
	    <scope>test</scope>
	</dependency>
	
 	<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
	<dependency>
	    <groupId>com.github.pagehelper</groupId>
	    <artifactId>pagehelper</artifactId>
	    <version>5.0.0</version>
	</dependency>
 	
 	
 
  	
  </dependencies>
  
  
  
  <build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<configuration>
				<source>1.8</source>
				<target>1.8</target>
			</configuration>
		</plugin>
	</plugins>
  </build>

  
</project>

        更新一下maven之后,有可能报错说是没有web.xml文件,这时候右键项目,把preference->project facets->Dynamic Web Module 2.5的勾去掉,之后重新把勾打上,这时候会有如下选项:

        点击further configuration available会弹出如下对话框,因为我们缺失的web.xml文件应该在src/main/webapp下,所有把该位置填入对应文本框,点击OK,之后保存设置,更新maven project,eclipse就会帮你自动把缺失的web.xml及META-INF等文件及文件夹建好。

        之后我们在webapp下创建static文件夹,放置我们的jquery及bootstrap。我们bootstrap官网下载bootstrap-3.3.7-dist.zip,之后解压,解压后有css、js、fronts等文件夹,将总文件夹bootstrap-3.3.7-dist放入static下。在jquery官网下载jquery-1.12.4.min.js文件,在static下创建js文件夹,把jquery-XXX.js放在js文件夹下,文件夹结构如下:

        好的,至此我们的项目就算是初步创建完成了,下一章我们继续补充这个项目。欲知后事如何,且待下回分解。

        (水平有限,如有错误,敬请指正)

猜你喜欢

转载自blog.csdn.net/u014627099/article/details/84945440
今日推荐