SSM框架基本XML配置

SSM框架基本XML配置

  • SSM(Spring+mybatis+SpringMVC)配置步骤
    • 导入jar包
    • web.xml
    • springmvc-servlet.xml
    • applicationContext.xml
    • mybatis-config.xml
    • mapper.xml

SSM(Spring+mybatis+SpringMVC)配置步骤

导入jar包



    
    
      org.springframework
      spring-webmvc
      4.3.7.RELEASE
    

    
      org.springframework
      spring-jdbc
      4.3.7.RELEASE
    

    
      org.springframework
      spring-aspects
      4.3.7.RELEASE
    

    
      org.springframework
      spring-test
      4.3.7.RELEASE
    
    
      org.mybatis
      mybatis
      3.4.5
    

    
      org.mybatis
      mybatis-spring
      1.3.1
    

    
      c3p0
      c3p0
      0.9.1.2
    

    
      mysql
      mysql-connector-java
      5.1.45
    

    
    
      org.glassfish.web
      jstl
      1.2
    
    
      javax.servlet
      servlet-api
      2.5
      provided
    
    
      junit
      junit
      4.12
    
  

web.xml




    

    
    
        contextConfigLocation
        classpath:applicationContext.xml
    
    
        org.springframework.web.context.ContextLoaderListener
    

    
    
        springmvc
        org.springframework.web.servlet.DispatcherServlet
        1
    
    
        springmvc
        /
    

    
    
        characterEncodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            UTF-8
        
        
            forceRequestEncoding
            true
        
        
            forceResponseEncoding
            true
        
    
    
        characterEncodingFilter
        /*
    
    
    
        hiddenHttpMethodFilter
        org.springframework.web.filter.HiddenHttpMethodFilter
    

    
        hiddenHttpMethodFilter
        /*
    


springmvc-servlet.xml



    
    
        
        
    

    
    
        
        
    

    
    
    
    
    

applicationContext.xml




    
        
    

    
    
    
    
    
        
        
        
        
    

    
    
        
        
        
        
        
        
        
    

    
    
        
        
    

    
    
        
        

    

    
    
        
        
        
        
    

    
    
        
            
            
            
            
        
    

    

mybatis-config.xml

因为applicationContext.xml里面配置了需要扫描的mapper文件所以这里面的就没写了。





    
    
        
        
    

    
    
        
    

mapper.xml




    

    

    
        INSERT INTO users (username,password) VALUES (#{username},#{password})
    

你可能感兴趣的:(spring)