Chinaunix

标题: Struts2整合Spring Hibernate的CRUD实例 [打印本页]

作者: appig    时间: 2008-12-01 20:55
标题: Struts2整合Spring Hibernate的CRUD实例

Struts 2 + Spring 2.0 + Hibernate 3.0整合的操作可以参照我的这篇文章
http://bbs.bccn.net/thread-239025-1-1.html
本文提供Struts2整合Spring Hibernate的CRUD的实例的源代码
1. 数据库脚本,数据库采用MySQL 5.0
CREATE TABLE `user` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(32) NOT NULL,
`password` varchar(32) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2. 几个重要的文件
web.xml
  contextConfigLocation
  /WEB-INF/applicationContext*.xml
  struts2
  
   org.apache.struts2.dispatcher.FilterDispatcher
  
  struts2
  /*
  
   org.springframework.web.context.ContextLoaderListener
  
  lazyLoadingFilter
  
   org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
  
  lazyLoadingFilter
  *.action
  /user/userAdd.jsp
applicationContext.xml
  
  
  
  
  
  
  
   
  
  
   
   
     org.hibernate.dialect.MySQLDialect
   
   
  
  
   
    org/ethip/catalog/model/User.hbm.xml
   
  
  
   
  
  
   
  
  
   
  
  
   
  
  
   
  
  
   
  
  
   
  
struts.xml

  
   userList.action
  
  
   /user/userList.jsp
  
  
   userList.action
  
  
   /user/userEdit.jsp
  
  
   userList.action
  

3. 本实例仅实现CRUD功能,没有实现其他的处理,如数据校验、国际化、分页等.
4. 由于附件过大,lib下所有的jar都删掉了,请各位学习者按照上一文的操作导入。
附件是ssh2目录结构



Struts2整合Spring Hibernate的CRUD实例.rar


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/11570/showart_1674775.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2