zoukankan      html  css  js  c++  java
  • hibernate 在web.xml中配置的作用

    1. 
    <filter> 
        <filter-name>Spring character encoding filter</filter-name> 
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 
        <init-param> 
          <param-name>encoding</param-name> 
          <param-value>GBK</param-value> 
    </init-param> 
    这个是用来处理乱码问题的 

    2. 
    <context-param> 
    <description>spring init </description> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>/WEB-INF/bean.xml</param-value> 
    </context-param> 
    这个配置是用来指定spring配置文件所在的位置的

    3.

    <listener> 
    <listener-class> 
    org.springframework.web.context.ContextLoaderListener 
    </listener-class> 
    这个是用来对spring容器进行初始化,做为监听器的

    4.

    <filter>

        <filter-name>hibernateFilter</filter-name>

            <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>

    </filter>

    这是Spring封装hibernate后提供的一个过滤器,这个过滤器的作用是:每一次请求来的时候都打开一个session每次请求结束后关闭session,解析hibernat延迟加载产生的异常。

  • 相关阅读:
    yum安装工具的理解
    Linux防火墙
    Python的优雅写法
    Python的time模块
    Python中根据提供的日期,返回是一年中的第几天
    观察者模式
    数据插入INSERT
    RSA加密、解密、签名、校验签名
    js的apply和call
    js插件编程-tab框
  • 原文地址:https://www.cnblogs.com/yaya-yaya/p/5822626.html
Copyright © 2011-2022 走看看