myeclipse5.5+eclipse3.2+spring1.2+struts1.2+hibernate3.1配置详解

不打算粘贴图片了。如果需要完整的WORD文档,或有什么不清楚的,或配置不成功的可以给我留言。

1.新建WEB PROJ

2.右击-----myeclipse---add spring capa….  

3.全选。然后点copy checked library...

4.下一步,默认new

5.add hibernate cap.

6.选择3.1 然后点copy checked library...

7.然后选择spring的配置文件

8.选择已经存在的spring配置文件,sessionID设成SessionFactory.

9.beanID设置成DataSource,在下拉框中无DB profile的话,要取消先,去添加一个DB profile后再从第5步开始.

10.如何添加一个DB profile稍微说一下:eclipse下windows下选open perspective选eclipse database explorer ,然后new一个database driver。new不来的人留言吧。。。

11.下一步,不要建立sessionfactory类 ,去掉勾勾。

12.keep package

13.new some java package (dao and po and vo and service)

14.再次打开database explorer 把刚才的profile打开,选择一个表,右键击之,选择hibernate reverse

15.抽象类不建立。最后templete也不建。选spring dao

16.add struts cap...

17.new form action and jsp

18. 在struts_config_xml中设置代理,把所有的ACTION的TYPE都设置为 org.springframework.web.struts.DelegatingActionProxy

并且在struts_config_xml最后部分加入代码

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">        

 <set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml" />

  </plug-in>

 **********注意,必须加到最后!!!!!!!!!!!!!!!!!

在spring的配置文件中(applicationcontext.xml)  <bean name="/login" class="com.hongsoft.web.action.LoginAction"  singleton="false">            <property name="service">            <ref bean="DemoService" />            </property>         </bean>   其中com.hongsoft.web.action.LoginAction是刚才在struts中覆盖的type属性中的值!!!!!  

19. 然后在action中调用自己建立的业务逻辑模块,

例如com.dp.service.system,

在service中写调用DAO的方法。

在Action中:service.adduser(); 在service中:dao.save();  

然后把spring(暂时当成类生成工具)写实例bean,如下所示:    

 <bean id="DemoService" class="facade.DemoService" singleton="false">       

  <property name="userDao">            

  <ref bean="UserDAO" />     

  </property>    

 </bean>

至此,小项目完成!!!!!!!!!!!!!!!!!!!!!  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值