SpringMVC开发环境搭建

2020-12-13 03:24

阅读:360

标签:允许   imp   dep   hand   patch   odi   undle   component   ORC   

1. 依赖包:

org.springframework
  spring-web
  5.1.7.RELEASEorg.springframework
  spring-webmvc
  5.1.7.RELEASE

2. SpringMVC的配置文件:

  在“src\main\resources”源代码目录下创建“spring/application.xml”配置文件;


       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvn="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
       https://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/mvc
       https://www.springframework.org/schema/mvc/spring-mvc.xsd">
    
    package="cn.ll.action" />
    
    default-servlet-handler />
    
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        class="org.springframework.context.support.ResourceBundleMessageSource">
        cn.ll.redis.message.pagescn.ll.redis.message.messageclass="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        
        class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver" >
        plugins/errors

3. 配置web.xml:


         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
         http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
    dispatcherServletclass>org.springframework.web.servlet.DispatcherServletclass>
        contextConfigLocationclasspath:spring/application.xml1dispatcherServlet/characterEncodingFilterclass>org.springframework.web.filter.CharacterEncodingFilterclass>
        encodingUTF-8forceEncodingtruecharacterEncodingFilter/*

 

SpringMVC开发环境搭建

标签:允许   imp   dep   hand   patch   odi   undle   component   ORC   

原文地址:https://www.cnblogs.com/luliang888/p/11074588.html


评论


亲,登录后才可以留言!