1、2019/5/27,School of Software, Sichuan University,1,J2EE层次设计架构典型的三层结构 表示层 (presentation) 主要处理用户和软件的交互 * 视窗图形界面(VB,PB)(Client) * 基于html的界面 (Server)领域层 (domain)(业务逻辑层)(Server or Client) 对输入和存储数据的计算 * Transation Script (属于结构性思维) * Domain Model(属于OO思维)基础架构层 (infrastructure) 存储持久数据,基 于 J2EE 的 开 发 技 术阮 树 骅
2、,2019/5/27,School of Software, Sichuan University,2,目前常见J2EE的API* JavaServer Pages(JSP)技术1.2 * Java Servlet技术2.3 * JDBC API 2.0 * Java XML处理API(JAXP)1.1 * Enterprise JavaBeans技术2.0 * Java消息服务(JMS)1.0 * Java命名目录接口(JNDI)1.2 * Java事务API(JTA) 1.0 * JavaMail API 1.2 * JavaBeans激活架构(JAF)1.0 * J2EE连接器体系结构(
3、JCA)1.0 * Java认证和授权服务(JAAS)1.0,基 于 J2EE 的 开 发 技 术阮 树 骅,2019/5/27,School of Software, Sichuan University,3,Presentation Tier,HTML Client,Java Applet/Java Applications,Web ServerHTML/XMLServletsJava Server Pages (JSPs),HTTP,Business Tier,Data Tier,Application Server,Existing System,Database,connector,
4、EJB Session Bean,EJB Entity Bean,RMI/IIOP,CORBA/IIOP,RMI/IIOP,Simplified J2EE Architecture,JDBC/SQLJ,JDBC/SQLJ,CORBA Client,基 于 J2EE 的 开 发 技 术阮 树 骅,2019/5/27,School of Software, Sichuan University,4,MVC(Model-View-Controller)软件设计模式1、模型(Model) 模型是应用程序的主体部分。模型表示业务数据,或者业务逻辑。2、视图(View) 视图是应用中与用户界面相关的部分。
5、是用户看到并与之交互的界面。 3、控制器(Controller) 控制器处理用户的输入。控制用户界面数据显示和更新Model对象状态。 实现了功能模块和显示模块的分离; 提高了应用系统的可维护性、可扩展性、可移植性 和组件的可复用性。,基 于 J2EE 的 开 发 技 术阮 树 骅,2019/5/27,School of Software, Sichuan University,5,2019/5/27,School of Software, Sichuan University,6,2019/5/27,School of Software, Sichuan University,7,iCarn
6、egie Library Project Model View Controller (MVC) architectureModel:JavaBeans _ *.java in library packageto represent the data and logic of the subset of the external world used in the programView:Java Server Pages _ *.jspto manages the output of a user interfaceController:Java Servlets _ *controller
7、.javato processes the users inputThe separation of tasks allows for easilymaintainable systems,基 于 J2EE 的 开 发 技 术阮 树 骅,2019/5/27,School of Software, Sichuan University,8,member (ssn, driverlicstate, driverlicnum, fname, lname, street, city, state, pcode, phone,email, passwd)librarian (ssn, fname, ln
8、ame, street, city, state,pcode, phone, email, passwd)booktitle (callnumber, name, author, edition, isbn, year, publisher)hold (ssn, callnumber, holddatetime)book (bookid, callnumber, borrowerssn, duedate, librarianssn)webuser:select on all tables/update on book,基 于 J2EE 的 开 发 技 术阮 树 骅,2019/5/27,Scho
9、ol of Software, Sichuan University,9,Library ObjectsJavaBeans Member, Librarian, Hold, Book and BookTitlea copy of the information in the database BookSet, BookTitleSet and HoldSet a set of Book, BookTitle and Hold objects LibraryMember, LibraryLibrarian, LibraryBook and LibraryBookTitle instantiate
10、 the lightweight objects,基 于 J2EE 的 开 发 技 术阮 树 骅,2019/5/27,School of Software, Sichuan University,10,Library ObjectsJavaBeans The DBWrapper classmaintains the connectivity to the database The CommonTags classa common header and footer for each page The Library classlog members and librarians incheck
11、 books in and out The LibraryUser class user interface,基 于 J2EE 的 开 发 技 术阮 树 骅,2019/5/27,School of Software, Sichuan University,11,Library ObjectsServlets Controller.java SearchController.java MemberLoginController.java MemberViewborrowedController.java MemberViewonholdController.java LibrarianLogin
12、Controller.java LibrarianCheckoutController.java LibrarianCheckinController.java,基 于 J2EE 的 开 发 技 术阮 树 骅,2019/5/27,School of Software, Sichuan University,12,基 于 J2EE 的 开 发 技 术阮 树 骅,2019/5/27,School of Software, Sichuan University,13,2019/5/27,School of Software, Sichuan University,14,2019/5/27,School of Software, Sichuan University,15,2019/5/27,School of Software, Sichuan University,16,2019/5/27,School of Software, Sichuan University,17,2019/5/27,School of Software, Sichuan University,18,