javaweb开发 idea ssm开发(一)
程序员文章站
2022-07-05 18:44:15
...
创建项目
- 新建一个空白项目
- 创建父工程
选中Maven 不要勾选任何框架->com.zf.edu common-parent

删除src 添加部分代码
 - 创建model子工程


新建一个model
先写字段, 然后按住快捷键生成方法(command n 选择setting 全选 确定)设置数据(command n 选择toString 全选 确定)
分别创建模块edu-dao edu-service
创建后台模块(edu-manager)选择webapp创建接口模块(edu-api)选择webapp
增加标识

webapp模型已经默认加了war标识
parent抽取公共的依赖

manager集成springMVC
manager
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<spring.version>4.3.14.RELEASE</spring.version>
</properties>
<!--#####添加依赖#####-->
<dependencies>
<!-- spring/springmvc 依赖 start-->
<!-- aop -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- aspects -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- beans -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- expression -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- orm -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- tx -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- spring/springmvc 依赖 end-->
</dependencies>
配置tomcat
选中edu-manager 进行配置
创建一个控制器
web.xmlspringmvc.xml控制器文件显示结果
更多精彩文章请关注 王明昌博客