完整代码如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!--启动注解识别,是对包进行扫描,实现注释驱动Bean定义,同时将bean自动注入容器中使用-->
<context:annotation-config/>
<!--后台controller程序的路径-->
<context:component-scan base-package="com.controller"/>

<!--开通静态资源的访问,即jsp或html文件-->
<mvc:default-servlet-handler/>
<!--让所有的Controller能够解析,不可缺少,<mvc:annotation-driven>里面那一整段,用来解决@ResponseBody传输字符串中文乱码问题-->
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<!-- 视图解析器/定位 -->
<bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 配置前缀 -->
<property name="prefix" value="/WEB-INF/jsp/"/>
<!-- 配置后缀 -->
<property name="suffix" value=".jsp"/>
</bean>
<!--文件上传 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
</beans>

部分截图如下:



最新文章

  1. PHP规范PSR2
  2. python更新后yum问题
  3. free一个无效指针
  4. js事件捕获,事件冒泡,事件委托以及DOM事件流
  5. SOAP 格式设置选项
  6. SuperGridControl 使用小技巧
  7. sgen.exe&quot; exited with code 1.解决方法
  8. LeetCode 343
  9. asp.net MVC 3多语言方案--再次写, 配源码
  10. STM32+NRF24L01无线(转)
  11. 在64位Win7环境+64位JDK下,运行64位Eclipse,提示“Failed to load the JNI shared library”错误,提示jvm.dll不对
  12. js压缩上传图片
  13. Filter 和 interceptor 的区别
  14. javaXML文件解析之DOM4J实操
  15. struts2常量配置
  16. shell编程-语句(八)
  17. 最短路径算法dijkstra的matlab实现
  18. 检查xml文件
  19. WPF点滴(1) Main 函数
  20. ubuntu下安装lamp环境

热门文章

  1. 基于Github Actions + Docker + Git 的devops方案实践教程
  2. python使用gitlab-api
  3. Jenkins性能测试
  4. CF908A New Year and Counting Cards 题解
  5. CF20B Equation 题解
  6. LuoguB2075 幂的末尾 题解
  7. java 数据类型:ArrayList;LinkList性能分析
  8. Android NDK开发篇:Java与原生代码通信(异常处理)
  9. win10 1909+ vs2015up3 使用fmt概述(fmt version 7.0.1)
  10. 【LeetCode】237. Delete Node in a Linked List 解题报告 (Java&Python&C++)