1. Add a visit to a static resource. Js/.img/.css
There are 3 types of methods:
1, change the path of the Springmvc Dispatherservlet urlpattern to "/*.do".
2. Add <mvc:default-servlet-handler>, and at the same time add the default mapping type in Web. xml to allow SPRINGMVC to identify those that can be released.
Add:<mvc:default-servlet-handler/> in the context of SPRINGMVC
In Web. xml
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.ico</url-pattern>
</servlet-mapping>
3. Using <mvc:resources >
<mvc:resources mapping= "" location= ""/>
2,springmvc adding support for Fastjson
Springmvc's httpmessageconverter is the use of mappingjackjson2httpmessageconverter, but is now generally used Ali's Fastjson, So I'm going to replace Fastjsonhttpmessageconverter.
<!--enhancement Annotations- <mvc:annotation-driven> <mvc:message-converters register-defaults= "false" > <bean class= "Com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter" id= " Fastjsonhttpmessageconverter "> <property name=" Supportedmediatypes "> <list> < value>application/json;charset=utf-8</value> </list> </property> <!--< Property Name= "Serializerfeature" >--> <!--This place with this function, you can configure some things, such as the format of the time, null output "" and so on . <!--</property>--> </bean> </mvc:message-converters> </MVC: Annotation-driven>
Add Fastjson maven dependencies to the Pom file
<!--Https://mvnrepository.com/artifact/com.alibaba/fastjson-- <dependency> <groupid >com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.47 </version> </dependency>
SPRING-SPRINGMVC Build (iii) SPRINGMVC add support for static resource access and support for Fastjson