zoukankan      html  css  js  c++  java
  • spring-mvc.xml中的配置

     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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
     5     xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
     6     xsi:schemaLocation="http://www.springframework.org/schema/beans
     7             http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
     8             http://www.springframework.org/schema/context
     9             http://www.springframework.org/schema/context/spring-context-3.2.xsd
    10             http://www.springframework.org/schema/aop
    11             http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
    12             http://www.springframework.org/schema/tx
    13             http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
    14             http://www.springframework.org/schema/mvc
    15             http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
    16             http://www.springframework.org/schema/context
    17             http://www.springframework.org/schema/context/spring-context-3.2.xsd">
    18 
    19     <!-- 使Spring支持自动检测组件,如注解的Controller -->
    20     <context:component-scan base-package="cn.smart.webapp.controller" />
    21     <context:annotation-config />
    22 
    23 
    24     <!--避免IE执行AJAX时,返回JSON出现下载文件 -->
    25     <bean id="mappingJacksonHttpMessageConverter"
    26         class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
    27         <property name="supportedMediaTypes">
    28             <list>
    29                 <value>text/html;charset=UTF-8</value>
    30             </list>
    31         </property>
    32     </bean>
    33 
    34 
    35     <!-- 启动SpringMVC的注解功能,完成请求和注解POJO的映射 -->
    36     <bean
    37         class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
    38         <property name="messageConverters">
    39             <list>
    40                 <ref bean="mappingJacksonHttpMessageConverter" /> <!-- JSON转换器 -->
    41             </list>
    42         </property>
    43     </bean>
    44 
    45 
    46     <!-- jsp视图解析器 -->
    47     <bean id="jspViewResolver"
    48         class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    49         <property name="viewClass"
    50             value="org.springframework.web.servlet.view.JstlView" />
          //下面value中的是jsp所在的路径
    51         <property name="prefix" value="WEB-INF/view/" />
    52         <property name="suffix" value=".jsp" />
    53 
    54     </bean>
    55 </beans>
  • 相关阅读:
    WordPress搭建的新博客 www.douzujun.club
    调用weka模拟实现 “主动学习“ 算法
    危险!80% 用户正在考虑放弃 Oracle JDK…
    最新!Dubbo 远程代码执行漏洞通告,速度升级
    Tomcat 又爆出高危漏洞!!Tomcat 8.5 ~10 中招…
    Spring Boot 启动,1 秒搞定!
    为什么要重写 hashcode 和 equals 方法?
    详解 Java 中 4 种 IO 模型
    详解GaussDB bufferpool缓存策略,这次彻底懂了!
    【API进阶之路6】一个技术盲点,差点让整个项目翻车
  • 原文地址:https://www.cnblogs.com/MrzhangKk/p/5274892.html
Copyright © 2011-2022 走看看