The Struts frame is to be the item of Apache Jakarta to constitute part to publish luck to do at the earliest stage, it inheritted MVC of each item characteristic, and did according to the characteristics of J2 EE correspond of variety with expand.The Struts frame was good to combine Jsp, Java Servlet, Java Bean, Taglib etc. technique.In the Struts, what to undertake the controller role in the MVC be an ActionServlet.The ActionServlet is an in general use control module.This control module provided a processing all HTTP claim which send out Struts of entrance point.Its interception with distribute these claim to arrive correspond of action type.(these action all of type is Action son type)Moreover the control module is also responsible for using to correspond of claim the parameter fill Action Form(FromBean), and pass action type(ActionBean).Action type the business logic of the interview core, then interview Java Bean or adjust to use EJB.End action type control the power pass follow-up of JSP document, from JSP document born see diagram.All these control logic make use of Struts-config.xml the document come to allocation.See diagram in the Struts frame main from JSP born page completion, the Struts provide abundant of JSP label database, this is advantageous to separating performance logic and procedure logic.The model is with 1 or the form existence of several Java Bean.In the Struts, main existence three kinds of Bean, respectively BE:Action, ActionForm, EJB perhaps Java Bean. The Struts frame have no concrete definition model layer of realization, in actually the development, model layer usually is close with business logic connect with each other, and want to carry on operation to the first floor data.The underneath's introduction is a kind of development strategy, lead the Hibernate into the model layer of Struts frame, usage it to carry on a data to pack with reflect to shoot, provide hold out for long time turn of support. 4 usage Hibernate and the Struts development J2 EE application 4.1 system structure diagram 3 manifestation according to Hibernate and Struts development strategy of system structure diagram.
Development practice underneath combine a development practice, with in the J2 the EE the application very widespread customer register process for example, elucidation above-mentioned system structure is how concrete usage.The process of register is very clear:Customer from register page login.jsp importation register information, system to register the information carry on verification, if exactitude success register, otherwise hint correspond mistake information. In the development process, the usage Eclipse be used as development environment and added to carry to provide to the Struts and the Hibernate in the meantime better control and support of three square plug-in MyEclipse, Web server usage Tomcat, the database chose to use Mysql. Carry on an allocation to the Hibernate first, need to the system auto the born hibernate.cfg.xml carry on modification, allocation good database conjunction of various parameter and definition the data reflect to shoot a document.Because the Hibernate take of conjunction pond main used for test, the function isn't very good, can pass JNDI will it modification is usage Tomcat of conjunction pond.
J2EE开源技术应用规范
1 引言
本文分析了Hibernate和Struts的机制,提出了一种基于Hibernate和Struts的J2EE应用开发策略。在这种策略中,模型层用Hibernate实现,视图和控制器则用Struts框架实现。这样可大大降低代码的耦合性以及提高系统的开发效率。 关键字 Hibernate,Struts,MVC,持久层。
随着Java技术的逐渐成熟与完善,作为建立企业级应用的标准平台,源)自(优尔+文=论]文]网[www.youerw.com,J2EE平台得到了长足的发展。借助于J2EE规范中包含的多项技术:EnterpriseJavaBean(EJB)、Java Servlets(Servlet)、Java Server Pages(JSP)、Java Message Service(JMS)等,开发出了许多应用系统。但是,在传统J2EE应用的开发过程中也出现了一些问题:1)数据模型和逻辑模型之间的矛盾。目前使用的数据库基本上都是关系型数据库,而Java本质上是一种面向对象的语言,对象在存储和读取时使用SQL和JDBC进行数据库操作,降低了编程的效率以及系统的可维护性;2)传统的J2EE应用多采用基于EJB的重量级框架,这种框架适合于开发大型企业应用,但是使用EJB容器进行开发和调试需要耗费大量时间。为了降低代码的耦合性,提高系统的开发效率,本文提出了一种基于Struts框架和Hibernate框架的J2EE应用开发策略。 J2EE开源技术应用英文文献和中文翻译(2):http://www.youerw.com/fanyi/lunwen_52246.html