1:在官方文档中查看配置所需要的依赖
2:配置前端控制器DispatcherServlet
<servlet>
<servlet-name>dispatcher(示例名称)</servlet>
<servlet-class>org.springframework.web.servlert.DispatcherServlet</servlet-class>
<!-- 配置springmvc需要加载的配置文件 -->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring-*.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher(与上面的sevlet-name相同)</servlet-name>
<!-- / 表示拦截所有资源,不包括jsp /* 包括jsp -->
<url-pattern>/</url-pattern>
</servlet-mapping>
解决Post乱码问题的配置
<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>
</filter-mapping>