用户名: 密码: 验证码:
基于struts框架利用hibernate技术开发Web应用程序
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
  • 英文题名:Utilize the Technology of Struts and Hibernate to Develop Web Application Program
  • 作者:臧红伟
  • 论文级别:硕士
  • 学科专业名称:软件工程
  • 学位年度:2004
  • 导师:张长海
  • 学科代码:081202
  • 学位授予单位:吉林大学
  • 论文提交日期:2004-05-01
摘要
随着internet的迅速发展,开发基于Browser/Server的服务器端的程序已经成为Web应用程序开发的重点。开发服务器端程序有众多技术,其中SUN公司提出的J2EE(Java 2 Enterprise Edition)已经逐渐成为企业Web应用开发的重点,这当中的Servlet/JSP技术也在众多网站得到了广泛的应用。尽管JSP让我们耳目一新,它使开发Web应用变得更为简单,但是它也有很多缺点。在仅使用JSP技术开发的Web应用中,业务逻辑处理和动态显示用的Java代码以及HTML混和在一起,使得阅读,调试和维护都变得困难重重。虽然我们可以利用JavaBean来优化开发,但是每个网页的代码还是很混乱。
    Struts作为一个通用的请求控制器框架可以进一步优化Web开发。它为Java Web开发提供一个灵活的模型-视图-控制器方法,将前台显示和业务逻辑完全分开,充分实现MVC模型思想。
    面向对象的开发方法是当今的主流,然而大部分企业应用不得不与关系数据库频繁交互,所以在企业级应用开发的环境中,对象,关系的映射(ORM)是一种耗时的工作。Hibernate是目前
    开发员普遍都很推崇的ORM,它是一个开放源代码的ORM,它对JDBC进行了轻量级的对象封装,使Java程序员可以随心所欲的使用对象编程思维来操纵数据库。
    本文正是基于J2EE的JSP和Servlet,采用struts作为框架,利用hibernate技术持久化数据,来编写服务器端应用程序。众所周知,JSP和Servlet是以Java语言为基础的技术,具有平台无关性。而struts是以MVC模型为基础,将功能模块和显示模块分离。至于新兴的hibernate,自从它一出现,就引起了大家的广泛关注。它完成了ORM(对象关系映射),从而使企业应用和他们的后端数据库的交互变得有效而迅捷,还提高了应用系统的可维护性,可扩展性,可移植性和组件的可复用性。
    文中论述了struts框架的基本设计思想和hibernate技术的ORM实现,然后给出了一个具体实例,最后利用自定义标签库设计大型Web应用,并总结了使用struts+hibernate开发系统的优缺点及前景。
With the rapid development of internet, developping the program of server end based on Browser/Server has already become one of important points in developing Web application.There are many technologies which we use to develop the programs of server end .Among them,J2EE which Sun put forward has already become the focal point of the development of enterprise Web application gradually. Servlet and JSP of J2EE have been applied to many Web sites widespread too. Though JSP lets us find everything fresh and new, it becomes simpler to develop Web application. But it has a lot of shortcomings. If we only utilize JSP to develop Web application, we will find that the mix of business logic, Java codes on dynamic display and HTML makes many difficulties in reading, debugging and maintaining. Though we can make use of JavaBean to optimize the developing process, the code of each web page is still very confused.
    Struts can optimize developing Web application further as a framework of controller in common use. It offeres a flexible Model-View-Controller method to develop Java Web.It makes display and business logic separate totally, fully realize MVC model thought.
    It is a current mainstream to OO development approach, but most enterprise applications have to use with the relational Database frequent and mutually. So, in the environment of development of enterprise application, the mapping of object and relation is a kind of job of consuming time. Hibernate is the ORM that many programmer at present praised highly very much generally. It is the ORM of a opening source code. It carries on the object encapsulations of lightweight to JDBC. This makes Java programmers handle freely the Database by utilizing OO programming thinking.
    This paper develop application program of server end based on JSP and Servlets of J2EE by using struts as frame and utilizing hibernate to make data persistence. As everyone knows, JSP and Servlet are the technology based on Java and they are independent of platform. Struts is based on MVC model and makes display module separate from function module. As for new developing hibernate, it causes everybody's extensive concern as soon as it appears. Hibernate finish ORM(object relation mapping), so it make the interaction of
    
    
    enterprise application and back end Database become effective and fast. It raises also the maintainability, expansibility, portability and reusability of application system.
    First, the paper describes the basic design thought of Struts' frame and the ORM of hibernate technology. Second, it gives one concrete instance, then designs large-scale Web application by using userdefined tag lib. At last, the paper analyses the advantage and disadvantage of using the association technology (struts and hibernate) to develop a system, moreover, the paper compares the association technology with the method of using JavaBean to develop Web application.
引文
[1] Chuck Cavanes编著《Jakarta Struts》 O’REILLY
    [2] James Goodwill 编著《Mastering Jakarta Struts》Wiley
    [3] Chuck Cavaness编著《Programming Jakarta Struts》
    [4] Ted Husted Cedric Dumoulin George Franciscus David Winterfeldt编著《Struts in Action》
    [5]《Hibernate2 Reference Documentation》Version2.0.1
    [6] 曹志刚《HIBERNATE-符合Java习惯的关系数据库持久化》
    [7] Subrahmanyam Allamaraju Cedric Buest John Davies等编著《J2EE编程指南》 电子工业出版社 北京 2002年3月第一版
    [8] 耿祥义 张跃平编著 《JSP实用教程》 清华大学出版社 北京2003年5月第一版
    [9] 飞思科技产品研发中心 编著《JSP 应用开发详解》北京 2002年1月第一版
    [10] JosePh L.Weber 编著,卜照斌 段来盛 赖伶等译《Java 2 编程详解》北京 1999年8月

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700