栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

SSM框架整合

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

SSM框架整合

SSM框架=Spring框架+SpringMVC框架+Mybatis框架

Spring框架:管理web层,业务层,dao层,持久层的各个组件,配置各种bean

SpringMVC框架:处理所有HTTP请求和响应,

M(model)模型:封装应用程序数据

V(View)视图:展现model的数据,页面渲染展示

C(controller)控制器:处理请求,将数据传递给视图进行渲染

Mybatis框架:封装jdbc

SpringMVC:

Dao层(mapper):数据持久层与数据库进行交互(定义增删查改的方法,配置文件中(mapper.xml)写具体的增删查改)

Service层:业务(功能)模块的逻辑设计(调用Dao层的接口实现)

Controller层:具体业务模块的流程控制(调用Service层的接口)

View层:页面显示

配置文件:

web.xml:配置Spring容器,前端控制器(SpringMVC配置)和过滤器



    
    
        contextConfigLocation
        classpath:applicationContext.xml
    
    
        org.springframework.web.context.ContextLoaderListener
    
    
    
        dispatcherServlet
        org.springframework.web.servlet.DispatcherServlet
        1
    
    
        dispatcherServlet
        /
    
    
    
        CharacterEncodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            UTF-8
        
        
            forceRequestEncoding
            true
        
        
            forceResponseEncoding
            true
        
    
    
        CharacterEncodingFilter
        /*
    
    
    
        HiddenHttpMethodFilter
        org.springframework.web.filter.HiddenHttpMethodFilter
    
    
        HiddenHttpMethodFilter
        /*
    
    
    
        HttpPutFormContentFilter
        org.springframework.web.filter.HttpPutFormContentFilter
    
    
        HttpPutFormContentFilter
        /*
    

applicationContext.xml:spring配置文件(数据库连接池,扫描包,业务逻辑)






    
    
        
        
    
    
    
    
        
        
        
        
    
    
    
        
        
        
        
        
        
    

    
    
        
        
    

    
    
        
        
    
    
    
        
        
        
    

    
    
        
        
        
        
    
    
    
        
            
            
            
            
        
    

springMVC-config.xml:SpringMVC配置文件(配置控制器,视图解析器)



    

    
        
        
    
    
    
        
        
    
    
    
    
    

 mybatis-config.xml:mybatis配置文件(与数据库相关)




    
    
        
    
    
    
        
    



    
    
        
    

jdbc.properties(数据库连接)

jdbc.jdbcUrl=jdbc:mysql://localhost:3306/ssm_test
jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.user=root
jdbc.password=123456

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/930783.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号