MVC: resources is added in the project configuration as follows:
Java code
- <MVC: annotation-driven/>
- <MVC: Resources Mapping = "/webeditor/**" location = "/webeditor/"/>
@ Responsebody: Chinese garbled characters appear in the Ajax request
The solution is as follows:
Java code
- <! --
- <MVC: annotation-driven/>
- <MVC: Resources Mapping = "/webeditor/**" location = "/webeditor/"/>
- -->
- <Context: component-scan base-package = "com. h2h. Zone. Web. Controller, Com. h2h. Zone. Web. Rest"/>
- <! -- Process Dynamic Resources -->
- <Bean id = "annotationmethodhandleradapter" class = "org. springframework. Web. servlet. MVC. annotation. annotationmethodhandleradapter">
- <Property name = "messageconverters">
- <List>
- <Bean class = "org. springframework. http. converter. stringhttpmessageconverter">
- <Property name = "supportedmediatypes">
- <List>
- <Value> text/plain; charset = UTF-8 </value>
- </List>
- </Property>
- </Bean>
- </List>
- </Property>
- </Bean>
- <Bean id = "defaultannotationhandlermapping" class = "org. springframework. Web. servlet. MVC. annotation. defaultannotationhandlermapping"> </bean>
- <! -- Process static resources -->
- <Bean id = "simpleurlhandlermapping" class = "org. springframework. Web. servlet. handler. simpleurlhandlermapping">
- <Property name = "urlmap">
- <Map>
- <Entry key = "/webeditor/**" value-ref = "imageresource"/>
- </Map>
- </Property>
- </Bean>
- <Bean id = "imageresource" class = "org. springframework. Web. servlet. Resource. resourcehttprequesthandler">
- <Property name = "locations">
- <List>
- <Value>/webeditor/</value>
- </List>
- </Property>
- </Bean>
- <Bean id = "httphandleradapter" class = "org. springframework. Web. servlet. MVC. httprequesthandleradapter"/>
- <! -- Process static resource end -->