搭建SpringMVC环境步骤
- 导入SpringMVC环境所需的jar包
- 配置web.xml,将请求交给框架处理
- 配置springmvc-servlet.xml进行详细配置
- 编写Controller
- 编写JSP页面
eclipse2020-06配置Dynamic Web Project创建web项目(图文)
eclipse2020-06创建web.xml
配置 web.xml
web.xml必须放在WEB-INF下面
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<!-- 编码过滤器 -->
<filter>
<filter-name>encoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>