zoukankan      html  css  js  c++  java
  • 简单配置springmvc-servlet.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:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.2.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd">

      <!-- 1、配置基于注解的映射器和适配器 -->
      <mvc:annotation-driven/>

      <!-- 处理静态资源 -->
      <mvc:default-servlet-handler/>
      <!-- <mvc:resources location="/css/" mapping="/css/**"></mvc:resources>
      <mvc:resources location="/vue/" mapping="/vue/**"></mvc:resources>
      <mvc:resources location="/js/" mapping="/js/**"></mvc:resources> -->

      <!-- 2、视图解析器 -->
      <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/"></property>
        <!-- <property name="suffix" value=".jsp"></property> -->
      </bean>

      <!-- 3、配置基于上下文进行组件扫描 -->
      <context:component-scan base-package="com.ssm.controller"></context:component-scan>

      <!-- 4、SpringMVC文件上传规定需配置 MultipartResolver处理器 -->
      <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="defaultEncoding" value="UTF-8" />
        <!-- 指定所上传文件的总大小,单位字节。注意maxUploadSize属性的限制不是针对单个文件,而是所有文件的容量之和 -->
        <property name="maxUploadSize" value="10485760" />
      </bean>

    </beans>

  • 相关阅读:
    【转】MySQL导入数据乱码的分析与解决
    查看MySQL的warning
    修改MySQL字符集
    【转】PHP乱码问题,UTF8(乱码)
    马哥Linux——第一周作业
    马哥Linux——第二周作业
    .Net内部运行过程
    Html那些事
    面向对象图解、类型转换图解,写给.Net新手
    javascript对于DOM加强
  • 原文地址:https://www.cnblogs.com/4AMLJW/p/ssm_ljw_201909091536.html
Copyright © 2011-2022 走看看