SpringMVC搭建

1、pom.xml

    3.0.1
    4.1.9.RELEASE
    1.7.25
    4.12
    2.9.4
    1.8
    1.2.40



    
    
        javax.servlet
        javax.servlet-api
        ${servlet.version}
        provided
    

    
    
        org.springframework
        spring-context
        ${spring.version}
    
    
        org.springframework
        spring-core
        ${spring.version}
    
    
        org.springframework
        spring-aop
        ${spring.version}
    
    
        org.springframework
        spring-tx
        ${spring.version}
    
    
        org.springframework
        spring-beans
        ${spring.version}
    
    
        org.springframework
        spring-web
        ${spring.version}
    
    
        org.springframework
        spring-webmvc
        ${spring.version}
    
    
        org.springframework
        spring-test
        ${spring.version}
    

    
    
        com.fasterxml.jackson.core
        jackson-databind
        ${jackson.version}
    
    
        com.fasterxml.jackson.core
        jackson-core
        ${jackson.version}
    
    
        org.codehaus.jackson
        jackson-core-asl
        1.9.13
    
    
        org.codehaus.jackson
        jackson-mapper-asl
        1.9.13
    

    
    
        org.slf4j
        slf4j-log4j12
        ${slf4j.version}
    

    
    
        com.alibaba
        fastjson
        ${fastJson.version}
    

    
    
        junit
        junit
        ${junit.version}
        test
    



    
        
        
            org.apache.maven.plugins
            maven-compiler-plugin
            2.3.2
            
                ${project.jdk.version}
                ${project.jdk.version}
            
        
        
        
            org.apache.tomcat.maven
            tomcat7-maven-plugin
            2.2
            
                
                tomcat7
                
                8080
                
                /springmvcTemplate
                
                http://127.0.0.1:8080/manager/text
                
                root
                root
            
        
    

2、SpringMVC配置文件spring-servlet.xml



    
    

    
    
        
            
                
                    
                        application/json;charset=UTF-8
                        text/html;charset=UTF-8
                        text/xml;charset=UTF-8
                        text/plain;charset=UTF-8
                    
                
            
        
    

    
    
        
        
        
    

3、web.xml



    
        contextConfigLocation
        classpath:spring/spring-application.xml
    
    
    
    
        org.springframework.web.context.ContextLoaderListener
    
    
    
    
        encodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            UTF-8
        
        
            forceEncoding
            true
        
    
    
        encodingFilter
        /*
    

    
    
        dispatcher
        org.springframework.web.servlet.DispatcherServlet
        
            contextConfigLocation
            classpath:spring/spring-servlet.xml
        
    
    
    
        dispatcher
        /
    

你可能感兴趣的:(SpringMVC搭建)