Spring MVC supports rest from 3.0, mainly through @pathvariable to handle the mapping of request parameters and paths.
Due to the reasons for the SEO, many people like the name of the news as part of the path to deal with, when the Chinese name will encounter problems, no way to map, this is because of coding problems, as long as the tomcat/conf to find Server.xml, add uriencoding= " UTF-8 "The URL encoding setting will solve the Chinese problem.
Also often encountered in the path a little ".", and the point is a special character, such as. html,. Do and so on, so spring MVC by default is to put the information behind the point as a file suffix, this time we need to modify this default value.
<bean class= "Org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" >
<property name= "interceptors" ref= "Localechangeinterceptor"/>
<property name= "Usedefaultsuffixpattern" value= "false"/>
</bean>
In addition, this time if only set this, the request can be passed to the controller, but pass the data will be a problem, only the last point of the data, unless you add "/" at the end, such as the/news/test. Point/This will be "test. Point" as a whole, or will only get " Test ". At this time we can set @requestmapping ("/news/{title:.*}")
That's all OK.
Springmvc @PathVariable ("B") double b loss accuracy problem