日期:2014-05-19  浏览次数:20895 次

SSH框架连接池如何配置呢?
各位大哥,小弟才初学浅,经理让我自己搞一个项目,我搭建了一个SSH框架,本机上访问localhost不会延迟,但是通过网络IP访问会延迟,有时候会乱码,多刷新几次又不会了。。
  能教下我如何优化框架呢???
  1。如何配置连接池呢,我这个框架是用SPRING管理的,配置了连接池是否不能采用SPRING管理。
  2。如何用HIBERNATE缓存功能优化页面
希望大家能发点实际的代码,教我下这个SPRING配置文件怎么改???
 
Java code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
        <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName"><value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value></property>
        <property name="url"><value>jdbc:sqlserver://localhost:1433;DatabaseName=shilikaifa</value></property>
        <property name="username"><value>sa</value></property>
        <property name="password"><value>test</value></property>   
        </bean>
    <!--配置事务管理器--> 
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> 

   <property name="sessionFactory"><ref local="sessionFactory"/></property> 

</bean> 
<bean id="transactionProxyFactory" abstract="true" lazy-init="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> 

    <property name="transactionManager"> 

         <ref local="transactionManager"/> 

    </property> 

    <property name="transactionAttributes"> 

         <props> 

          <prop key="save*">PROPAGATION_REQUIRED</prop> 

           <prop key="insert*">PROPAGATION_REQUIRED</prop> 

           <prop key="del*">PROPAGATION_REQUIRED</prop> 

           <prop key="add*">PROPAGATION_REQUIRED</prop> 

           <prop key="update*">PROPAGATION_REQUIRED</prop> 

           <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> 

           <prop key="search*">PROPAGATION_REQUIRED,readOnly</prop> 

           <prop key="remove*">PROPAGATION_REQUIRED,readOnly</prop> 

           <prop key="query*">PROPAGATION_REQUIRED,readOnly</prop> 

           <prop key="list*">PROPAGATION_REQUIRED,readOnly</prop> 

           <prop key="count*">PROPAGATION_REQUIRED,readOnly</prop> 

           <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> 

    </props> 

   </property> 

    </bean> 
    <bean id="hibernateInterceptor"
        class="org.springframework.orm.hibernate3.HibernateInterceptor">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
    </bean>
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">
                    org.hibernate.dialect.SQLServerDialect  
                </prop>
                <!-- 表示允许自动提交 -->
                <prop key="hibernate.