• dispatcherservlet.xml文件配置模板


    完整代码如下:

    <?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>

    部分截图如下:






  • 相关阅读:
    Spark学习之路 (五)Spark伪分布式安装
    Spark学习之路 (四)Spark的广播变量和累加器
    Spark学习之路 (三)Spark之RDD
    Spark学习之路 (二)Spark2.3 HA集群的分布式安装
    Spark学习之路 (一)Spark初识
    通俗理解梯度下降
    通俗理解线性回归(二)
    通俗理解线性回归(一)
    python机器学习手写算法系列——线性回归
    CSS中display对布局的影响以及元素display的默认值
  • 原文地址:https://www.cnblogs.com/c2g5201314/p/11389795.html
Copyright © 2020-2023  润新知