Spring Hibernate Struts

  <?xml version="1.0" encoding="UTF-8" ?>
  <!DOCTYPE struts-config (View Source for full doctype...)>
- < struts-config >
  < data-sources />
- < form-beans >
  < form-bean name =" researcherForm " type =" actions.ResearcherForm " />
  < form-bean name =" projectForm " type =" actions.ProjectForm " />
  </ form-beans >
  < global-exceptions />
  < global-forwards />
- < action-mappings >
- < action attribute =" researcherForm " input =" /researcher/insert.jsp " name =" researcherForm " path =" /researcher " scope =" request " type =" actions.ResearcherAction " validate =" false ">
  < forward name =" queryPage " path =" /researcher/query.jsp " />
  </ action >
- < action attribute =" projectForm " input =" /project/insert.jsp " name =" projectForm " path =" /project " scope =" request " type =" actions.ProjectAction " validate =" false ">
  < forward name =" queryPage " path =" /project/query.jsp " />
  </ action >
  </ action-mappings >
  < message-resources parameter =" actions.ApplicationResources " />
- <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
  <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
  </plug-in>
  </ struts-config >
..................................................................................................................................................
  <?xml version="1.0" encoding="UTF-8" ?>
- < beans xmlns =" http://www.springframework.org/schema/beans " xmlns:xsi =" http://www.w3.org/2001/XMLSchema-instance " xmlns:aop =" http://www.springframework.org/schema/aop " 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.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd ">
- <!--
 配置数据源 
  --> <script></script>
- < bean id =" dataSource " class =" org.springframework.jdbc.datasource.DriverManagerDataSource ">
- < property name =" driverClassName ">
  < value > com.mysql.jdbc.Driver </ value >
  </ property >
- < property name =" url ">
  < value > jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&autoReconnect=true&autoReconnectForPools=true </ value >
  </ property >
- < property name =" username ">
  < value > root </ value >
  </ property >
- < property name =" password ">
  < value > </ value >
  </ property >
  </ bean >
- <!--
 配置SessionFactory 
  --> <script></script>
- < bean id =" mySessionFactory " class =" org.springframework.orm.hibernate3.LocalSessionFactoryBean ">
- < property name =" mappingResources ">
- < list >
  < value > beans/Researcher.hbm.xml </ value >
  < value > beans/Project.hbm.xml </ value >
  </ list >
  </ property >
- < property name =" hibernateProperties ">
- < props >
  < prop key =" hibernate.dialect "> org.hibernate.dialect.MySQLDialect </ prop >
  < prop key =" hibernate.show_sql "> true </ prop >
  < prop key =" current_session_context_class "> thread </ prop >
  < prop key =" hibernate.cache.provider_class "> org.hibernate.cache.EhCacheProvider </ prop >
  < prop key =" connection.pool_size "> 10 </ prop >
  < prop key =" hibernate.hbm2ddl.auto "> update </ prop >
  </ props >
  </ property >
- < property name =" dataSource ">
  < ref bean =" dataSource " />
  </ property >
  </ bean >
- < bean id =" researcherDAO " class =" dao.ResearcherDAO ">
- < property name =" sessionFactory ">
  < ref local =" mySessionFactory " />
  </ property >
  </ bean >
- < bean id =" researcherService " class =" service.ResearcherService ">
- < property name =" researcherDAO ">
  < ref local =" researcherDAO " />
  </ property >
  </ bean >
- < bean id =" projectDAO " class =" dao.ProjectDAO ">
- < property name =" sessionFactory ">
  < ref local =" mySessionFactory " />
  </ property >
  </ bean >
- < bean id =" projectService " class =" service.ProjectService ">
- < property name =" projectDAO ">
  < ref local =" projectDAO " />
  </ property >
  </ bean >
  </ beans >
00000000000000000000000000000000000000000000000000000000000000000000
  <?xml version="1.0" encoding="UTF-8" ?>
- < web-app xmlns =" http://java.sun.com/xml/ns/j2ee " xmlns:xsi =" http://www.w3.org/2001/XMLSchema-instance " version =" 2.4 " xsi:schemaLocation =" http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">
  < display-name > Sample </ display-name >
- < servlet >
  < servlet-name > action </ servlet-name >
  < servlet-class > org.apache.struts.action.ActionServlet </ servlet-class >
- < init-param >
  < param-name > config </ param-name >
  < param-value > /WEB-INF/struts-config.xml </ param-value >
  </ init-param >
- < init-param >
  < param-name > debug </ param-name >
  < param-value > 3 </ param-value >
  </ init-param >
- < init-param >
  < param-name > detail </ param-name >
  < param-value > 3 </ param-value >
  </ init-param >
  < load-on-startup > 0 </ load-on-startup >
  </ servlet >
- < servlet-mapping >
  < servlet-name > action </ servlet-name >
  < url-pattern > *.do </ url-pattern >
  </ servlet-mapping >
  </ web-app >
000000000000000000000000000000000000000000000000
  <?xml version="1.0" ?>
  <!DOCTYPE hibernate-mapping (View Source for full doctype...)>
- < hibernate-mapping package =" beans " default-cascade =" none " default-access =" property " default-lazy =" true " auto-import =" true ">
- <
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值