SpringMvc的InternalResourceViewResolver
在前面我们说过使用Html页面作为视图进行返回时,给返回值加上前缀"forward:"在处理后返回的thymeleafView就会变成InternalResourceView,那是使用了thymeleaf作为视图处理器,现在使用InternalResourceViewResolver作为视图解析器,他一般解析jsp后缀的视图。
配置一个新的model
1、配置pom.xml文件【设置打包方式】、【引入依赖并刷新】, 在项目结构中添加WEB-INF目录和web.xml文件 配置web.xml文件【设置请求控制器DispatcherServlet】、【添加请求控制器的初始化参数设置SpringMvc的配置文件位置】、【设置CharacterEncodingFilter,通过初始化参数规定请求与响应的字符编码格式】
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>SpringMvc_jsp&