myeclipse 开发SSH(struts+hibernate+spring)

网上有许多相关的文档,参考资料里有详细的说明,这里只是把需注意的地方记录一下:

步骤:struts -----spring ---hibernate

第一步:struts

  1. public ActionForward execute(ActionMapping mapping, ActionForm form,
  2.             HttpServletRequest request, HttpServletResponse response) {
  3.         LoginForm loginForm = (LoginForm) form;// TODO Auto-generated method stub
  4.         if ( username.equals ( "test" ) && password.equals ("test") )        {
  5.                 return mapping.findForward ( "indexForword" );
  6.               } else {
  7.                 return mapping.getInputForward();
  8.               }
  9.     }

第二步:spring

注意:spring选择spring1,applicationContext.xml路径需注意下,在src下改为“/WEB-INF/classes/applicationContext.xml”,在web-inf下为"/WEB-INF/applicationContext.xml"

更改type="org.springframework.web.struts.DelegatingActionProxy"

plug-in放在message-resources下面(struts-config)

如有错误,到myeclipse找spring.jar包copy过去。

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
  3. <struts-config>
  4.   <data-sources />
  5.   <form-beans >
  6.     <form-bean name="loginForm" type="com.dreamity.struts.form.LoginForm" />
  7.   </form-beans>
  8.   <global-exceptions />
  9.   <global-forwards />
  10.   <action-mappings >
  11.     <action
  12.       attribute="loginForm"
  13.       input="/login.jsp"
  14.       name="loginForm"
  15.       path="/login"
  16.       scope="request"
  17.       type="org.springframework.web.struts.DelegatingActionProxy">
  18.       <forward name="failture" path="/login.jsp" />
  19.       <forward name="success" path="/index.jsp" />
  20.     </action>
  21.   </action-mappings>
  22.   <message-resources parameter="com.dreamity.struts.ApplicationResources" />
  23.   <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
  24.     <set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml" />
  25. </plug-in>
  26. </struts-config>

第三步:hibernate

程序以四层结构来写,结构如附件。

https://p-blog.csdn.net/images/p_blog_csdn_net/bill1315/EntryImages/20081202/截图01.jpg

参考资料:

1,使用myeclipse集成struts,hibernate,spring的一个示例程序   http://www.cnblogs.com/xujiaci/archive/2007/10/11/920597.html

2,MyEclipse开发SSH(Struts+Spring+Hibernate)入门 http://blog.tanggaowei.com/2007/12/myeclipsesshstrutsspringhibernate.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值