1 一个简单的springmvc项目 github的地址
https://github.com/arpitmandliya/SpringMVCHelloWorldExample
2 解决springmvc不能访问html页面
web.xml
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
https://www.geek-share.com/detail/2792954189.html
3 spring mvc 中对静态资源的访问配置
选择其中任意一种
<!-- 方式1 静态资源访问处理 这种方法就是利用容器的default servlet来处理先 -->
<mvc:default-servlet-handler/>
<!-- 方式2 静态资源访问处理 org.springframework.web.servlet-3.1.4版本及以后使用 -->
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<mvc:resources mapping="/static/**" location="/static/" />
<mvc:resources mapping="/resources/**" location="/resources/" />
<mvc:resources mapping="/images/**" location="/images/" />
<mvc:resources mapping="/js/**" location="/js/" />
https://blog.csdn.net/whereismatrix/article/details/54237699
4 controller返回json出错 No converter found for return value of type:
<properties>
<jackson.version>2.5.4</jackson.version>
</properties>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>