zoukankan      html  css  js  c++  java
  • SSH(Struts+spring+hibernate)配置

    1、spring和struts

      1)web.xml

        配置spring的ContextLoaderListener(监听器)

        配置Struts的StrutsPrepareAndExecuteFilter(过滤器)

      2)applicationContext.xml

        配置service、dao、bean

        配置Struts的每个action为bean,并指明scope=“prototype”

      3)Struts.xml

        配置每个action,并且class=bean的id

    2、spring和hibernate

      1)bean.hbm.xml(每一个bean对应一个,里面包含该bean的各个属性定义描述)

      2)applicationContext.xml

        配置数据库连接和root,pwd等

        配置bean的映射路径(即上面的bean.hbm.xml的路径)

        配置sessionFactory

        配置事务管理(可选)

    3、ssh

       解决延迟加载:OpenSessionInViewFilter(作用:为每个请求绑定一个hibernatesession,能够自动被spring失误管理器探测到,当事物完成后并不会关闭session,因此可以在web层进行继续查询数据库加载数据)

       配置web.xml( 在StrutsPrepareAndExecuteFilter配置OpenSessionInViewFilter

        

  • 相关阅读:
    递归获取指定盘符下的所有文件及文件夹
    单例模式和多线程有没有关系?
    eclipse启动tomcat时设置端口
    dozer转化对象
    枚举
    dubbo
    json
    配网失败问题
    esp_err_t esp_event_loop_init(system_event_cb_t cb, void *ctx);
    base64编码
  • 原文地址:https://www.cnblogs.com/51python/p/10747090.html
Copyright © 2011-2022 走看看