SpringMVC的开始启动 {#id-head}
目录
一、新建一个web项目
二、导入jar包添加依赖
三、配置web.xml 注册DispatcherServlet
四、配置springmvc-servlet.xml
五、创建控制器
六、创建视图层
七、测试并调试
一、新建web项目(略) {#id-01}
二、导入jar包添加依赖 {#id-02}
- junit
- spring-webmvc
- servlet-api
- jsp-api
- jstl
<!-- 单元测试包 -->
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<!-- springMVC框架包 -->
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.2.16.RELEASE</version>
</dependency>
<!-- servlet包 -->
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<!-- JSP标准标签库 -->
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
tomcat插件
<plugin