`
javaeye_hua
  • 浏览: 79013 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

myEclipse自动搭建SSH框架

阅读更多

1.使用myEclipse导入:struts、hibernate、spring
2.手动拷贝spring.jar到lib目录下。
3.applicationContext.xml:
  <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.5.xsd
  http://www.springframework.org/schema/tx
     http://www.springframework.org/schema/tx/spring-tx.xsd
  http://www.springframework.org/schema/aop
     http://www.springframework.org/schema/aop/spring-aop.xsd">

 <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="configLocation"
   value="classpath:hibernate.cfg.xml">
  </property>
 </bean>
 <!-- enable the configuration of transactional behavior based on annotations -->
  <tx:annotation-driven transaction-manager="transactionManager"/>

  <!-- a PlatformTransactionManager is still required -->
   <!-- 定义TransactionManager -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" >
        <property name="sessionFactory" ref="sessionFactory" />
    </bean> 
 
</beans>
4. struts-config.xml:
   <action-mappings>
<!--     <action path="/testAction" type="org.springframework.web.struts.DelegatingActionProxy" />-->
  </action-mappings>
  <message-resources parameter="com.automic.struts.ApplicationResources" />
   <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
   <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"/>
 </plug-in>

3
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics