SSH结构的环境搭建及配置

******************beans.xml******************

 


       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
          http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
 
 
 
 
   
   
  
  
  
  
  
  
  
   
  
  
  
   
  
   
  
  
 

  
  
     
     
     
        cn/itcast/bean/user/Person.hbm.xml
     

     

     
     
          hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
          hibernate.hbm2ddl.auto=update
          hibernate.show_sql=false
          hibernate.format_sql=false
          hibernate.cache.use_second_level_cache=true
                hibernate.cache.use_query_cache=false
             hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
       

    

 

  
    
  

 
 

 
 
   

 

 

 

******************ecache.xml******************

 



   
            timeToIdleSeconds="120"
        timeToLiveSeconds="180"
        diskPersistent="false"
        diskExpiryThreadIntervalSeconds="60"/>
     overflowToDisk="true" timeToIdleSeconds="300" timeToLiveSeconds="600" diskPersistent="false"/>

 

******************jdbc.properties******************

 

 

driverClassName=org.gjt.mm.mysql.Driver
url=jdbc:mysql://localhost:3306/itcast?useUnicode=true&characterEncoding=UTF-8
username=root
password=123456
initialSize=1
maxActive=300
maxIdle=1
minIdle=1

 

 

******************struts-conf.xml******************

 


          "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
          "http://struts.apache.org/dtds/struts-config_1_3.dtd">

 
  
 

 
  
 

 
  
   
  

 

 
 
 

 

 

 

******************web.xml******************

 


 xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 
 
    contextConfigLocation
    classpath:beans.xml
 

 
 
       org.springframework.web.context.ContextLoaderListener
 

 
 
 
  encoding
  org.springframework.web.filter.CharacterEncodingFilter
  
   encoding
   UTF-8
  

 

 
  encoding
  /*
 

 
 
 
         OpenSessionInViewFilter
         org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
       
   
             sessionFactoryBeanName
             sessionFactory
      

 

 
         OpenSessionInViewFilter
         /*
 

 
 
  struts
  org.apache.struts.action.ActionServlet
  
   config
   /WEB-INF/struts-config.xml
  

  0
 

 
  struts
  *.do
 

 
    index.jsp
 

 

 

 

******************初始化******************

 

 @BeforeClass
 public static void setUpBeforeClass() throws Exception {
  try {
   ApplicationContext act = new ClassPathXmlApplicationContext("beans.xml");
   personService = (PersonService)act.getBean("personService");
  } catch (RuntimeException e) {
   e.printStackTrace();
  }
 }

你可能感兴趣的:(技术分享,ssh,spring,encoding,bean,class,struts)