webmvc.xml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
  6. <mvc:annotation-driven>
  7. <!-- 解决Controller返回String时中文乱码的问题 -->
  8. <mvc:message-converters>
  9. <bean class="org.springframework.http.converter.StringHttpMessageConverter">
  10. <!-- 不可为text/plain -->
  11. <property name="supportedMediaTypes" value="text/html;charset=UTF-8" />
  12. </bean>
  13. </mvc:message-converters>
  14. </mvc:annotation-driven>
  15. <mvc:default-servlet-handler />
  16. <mvc:resources mapping="/static/**" location="/resources/" />
  17. <context:component-scan base-package="com.uas.report" />
  18. <bean id="multipartResolver"
  19. class="org.springframework.web.multipart.commons.CommonsMultipartResolver" />
  20. <bean
  21. class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  22. <property name="prefix" value="/WEB-INF/views/" />
  23. <property name="suffix" value=".html" />
  24. <property name="contentType" value="text/html;charset=UTF-8" />
  25. </bean>
  26. <mvc:view-controller path="/" view-name="index" />
  27. <mvc:view-controller path="/console" view-name="console" />
  28. <mvc:view-controller path="/fileUpload" view-name="fileUpload" />
  29. <mvc:view-controller path="/preview" view-name="preview" />
  30. <mvc:view-controller path="/files" view-name="files" />
  31. </beans>