0.1概述
Spring MVC 是spring的一个模块,专门做web开发的。
好处:
1.基于MVC架构,功能明确,解耦合
2.容易理解,上手快,使用简单
3.作为spring框架的一部分,能够使用spring的ioc和aop,方便整合其他框架
官网:https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#spring-web
0.2web开发步骤
1.加入spring-webmvc依赖,间接把spring的依赖都加入到项目中
<!--springwebmvc依赖,间接包含spring的依赖-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.2.5.RELEASE</version>
</dependency>
2.加入jsp、servlet依赖
<!--jsp依赖-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!--servlet依赖-->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2.1-b03</version>
<scope&