MyEclipse8.5搭建ssh2框架

MyEclipse8.5搭建ssh2框架

建一个web工程

工程中右键点击添加struts支持,》》》在选择Struts2.1,选择/*》》》选择core核心包

工程中右键点击添加spring支持,》》》在选择1,spring 3.0 aop libraries

                                                                                         2,spring 3.0 core libraries

                                                                                              3,spring 3.0 persistence core libraries

                                                                                              4,spring 3.0 persistence jdbc liberaries

                                                                                             5,spring 3.0 web libraries

最后添加hibernate支持:只选Hibernate 3.3 core libraries》》》再选springconfiguation file

使用spring配置文件》》》》在选择Existing spring configuration file 已经存在的spring配置文件》》》到最后去掉勾选 create sessionfactory class  不用再创建sessionfactory了。

 

5在src目录下建一个dto的包

选择dbBrowser视图,选中要创建的表,右键选中hibernate reverse engineering

在选中dto目录

Create pojo<>db table mapping information勾选

Java data object(pojo……勾选 createabstract class 不用选

Java data Access object……. 勾选,generateprecise findBy method….勾选

Next》》》》className:dto.MapDto

                   IdGenerator :sequence

 

Web.xml添加:

  <context-param>

       <param-name>contextConfigLocation</param-name>

       <param-value>classpath:applicationContext.xml</param-value>

 </context-param>

  <listener>

       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

 </listener>

 

 

Applicationcontext.xml添加

 <?xml version="1.0"encoding="UTF-8"?>

<beans

         xmlns="http://www.springframework.org/schema/beans"

         xmlns:aop="http://www.springframework.org/schema/aop"

         xmlns:tx="http://www.springframework.org/schema/tx"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xmlns:p="http://www.springframework.org/schema/p"

         xsi:schemaLocation="http://www.springframework.org/schema/beans

         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

         http://www.springframework.org/schema/aop

         http://www.springframework.org/schema/aop/spring-aop-3.0.xsd

         http://www.springframework.org/schema/tx

         http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

 

 

         <beanid="dataSource"class="org.apache.commons.dbcp.BasicDataSource">

                   <propertyname="driverClassName"value="oracle.jdbc.driver.OracleDriver"></property>

                   <propertyname="url"value="jdbc:oracle:thin:@localhost:1521:orcl"></property>

                   <propertyname="username" value="zhou"></property>

                   <propertyname="password" value="z1234"></property>

         </bean>

         <beanid="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

                   <propertyname="dataSource"><ref bean="dataSource"/></property>

                   <propertyname="hibernateProperties">

                            <props>

                                     <propkey="hibernate.dialect">

                                               org.hibernate.dialect.Oracle9Dialect

                                     </prop>

                            </props>

                   </property>

                   <propertyname="mappingResources">

                            <list>

                                     <value>dto/MapDto.hbm.xml</value></list>

                   </property></bean>

                  

                   <bean id="mytx"class="org.springframework.orm.hibernate3.HibernateTransactionManager">

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

                   </bean>

                  

         <beanid="MapDtoDAO" class="dao.MapDtoDAOImpl">

                   <propertyname="sessionFactory"><ref bean="sessionFactory"/>

                   </property>

         </bean>

        

         <tx:advice id="myadvice"transaction-manager="mytx">

                   <tx:attributes>

                            <tx:method name="add*"propagation="REQUIRED"/>

                            <tx:method name="modify*"propagation="REQUIRED"/>

                            <tx:method name="del*"propagation="REQUIRED"/>

                            <tx:method name="*"propagation="SUPPORTS"/>

                   </tx:attributes>

         </tx:advice>

         <aop:config>

                   <aop:pointcut expression="execution(*biz.*.*(..))" id="mypoint"/>

                   <aop:advisor advice-ref="myadvice"pointcut-ref="mypoint"/>

         </aop:config>          

         </beans>

 写好业务层,和dao层

启动tomcat报错

 因为少了一个包   struts2-spring-plugin-2.1.8.1

添加进去就可以了。
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值