4-Tier Model Client Tier Web Tier Business Tier EIS Tier.

Slides:



Advertisements
Similar presentations
A plataforma J2EE.
Advertisements

12 Copyright © 2005, Oracle. All rights reserved. Implementing Business Tasks with Session EJBs.
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
University of Texas at Dallas Anna Yi
Writing Enterprise Applications with J2EE (First lesson) Alessio Bechini June 2002 (based on material by Monica Pawlan)
Enterprise Java Beans Welcome to the world of “Distributed System” Presented By: Sameer Nanda Date: 12/17/03.
Application Server Lecture Paulo Barroso Kris Carver Todd Kitterman Eric Silva.
Writing Enterprise Applications with J2EE (Third lesson) Alessio Bechini June 2002 (based on material by Monica Pawlan)
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
J2EE Java2 Enterprise Edition by Damian Borth. Contents Introduction Architectures styles Components Scenarios Roles Processing a HTTP request.
J2EE Java 2 Enterprise Edition. Relevant Topics in The Java Tutorial Topic Web Page JDBC orial/jdbc
Current Topics in Programming Languages Lecture 15_1 George Koutsogiannakis SUMMER
CS 483 Enterprise and Web Application Programming
Emmanuel Cecchet et al.  Performance Scalability of J2EE application servers.  Test effect of: ◦ Application Implementation Methods ◦ Container Design.
Java Pet Store Application. Outline Introduction Introduction Information Layer Information Layer Application Layer Application Layer Infrastructure Layer.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
Distributed Multitiered Applications The J2EE platform uses a multitiered distributed application model. Application logic is divided into components 1.
EJB. Component Characteristics An enterprise Bean typically contains business logic that operates on the enterprise’s data. An enterprise Bean’s instances.
IMS Technical Conference IMS Java Remote Database Services Kyle Charlet.
Brad Rippe Fullerton College. What you need to get started? JDK 1.3 standard for compilation J2EE - SDK1.2.1 App Server - An EJB Container/Web Container.
1 Session Bean Chuyên đề Lập trình Java & J2EE Chương 14 Biên soạn: Th.S Nguyễn văn Lành.
J2EE Part 2: Enterprise JavaBeans CSCI 4300 Images and code samples from jGuru EJB tutorial,
© 2005 by IBM; made available under the EPL v1.0 | March 1, 2005 Tim deBoer Gorkem Ercan Extend WTP Server Tools for your.
Ing. Ignacio Roqueta ARTech GeneXus and J2EE.
Seminar: Enterprise JavaBeans. Agenda Agenda Java™ 2 Platform Java™ 2 Platform Java™ 2 Platform,Enterprise Edition(J2EE) Java™ 2 Platform,Enterprise Edition(J2EE)
Writing Enterprise Applications with J2EE (Second lesson) Alessio Bechini June 2002 (based on material by Monica Pawlan)
© D. Wong  Indexes  JDBC  JDBC in J2EE (Java 2 Enterprise Edition)
Advanced Java Session 7 New York University School of Continuing and Professional Studies.
Entity Java Beans Jorg Janke Open Source ERP & CRM.
Container-Managed Persistence (CMP) Entity Beans Lesson 3A / Slide 1 of 42J2EE Server Components Objectives In this lesson, you will learn to: Identify.
Presented By Pradeep K Sahu. What will be the Contents of the Seminar ? What is EJB ? EJB Architecture Types of EJB Session Entity Why EJB ? Writing a.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Introduction to J2EE Architecture Portions by Kunal Mehta.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
TDDD05 EJB Lab (Part of slides reused from Mikhail’s) Lu Li
Java Server Pages A JSP page is a text-based document that contains two types of text: static template data, which can be expressed in any text-based format,
|Tecnologie Web L-A Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat
第十四章 J2EE 入门 Introduction What is J2EE ?
J2EE Structure & Definitions Catie Welsh CSE 432
1 Lecture 16 George Koutsogiannakis/SUMMER 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
J2EE Overview Web Programming CSCI J2EE multi-tier architecture Servlet: Java class loaded into Web server JSP page: enhanced HTML page that is.
Enterprise JavaBeans Understanding EJB Components Version 0.1 Kamal Wickramanayake
Writing Enterprise Applications with J2EE (Fourth lesson) Alessio Bechini June 2002 (based on material by Monica Pawlan)
Matthew Ellis rd January 2006 CM610 Assignment Bsc(Hons) Computing Studies.
A seminar on j2ee by saritha. s. What is J2EE J2EE (Java 2 Platform, Enterprise Edition) is a Java platform designed for the mainframe-scale computing.
Entity Beans & Persistence Chris Alexander CS 486 Spring 2001.
17 Copyright © 2004, Oracle. All rights reserved. Deploying an ADF Application.
©NIIT Introducing Enterprise JavaBeans (EJB) Lesson 1A / Slide 1 of 43J2EE Server Components Objectives In this lesson, you will learn about: The features.
D Copyright © 2004, Oracle. All rights reserved. BMP Entity EJBs J2EE Connector Architecture.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Advanced Java Session 7 New York University School of Continuing and Professional Studies.
14 Copyright © 2004, Oracle. All rights reserved. Achieving State Management in the Business Tier.
17 Copyright © 2004, Oracle. All rights reserved. Integrating J2EE Components.
JAVA & J2EE UNIT – 8 ENTERPRISE JAVA BEAN - EJB 28-Jun-16 Prepared by: SANTHIYA.M & GANGA V. C. Department: Computer Science & Engineering Course code:
©NIIT Session Beans Lesson 1B/ Slide 1 of 37J2EE Server Components Objectives In this lesson, you will learn to: Describe the characteristics of session.
Enterprise Java Beans. Contents  Understanding EJBs  Practice Section.
By Dr. Kodge Bheemashankar G
Introduction to J2EE Architecture
ICS 237- Distributed Systems Middleware Nalini Venkatasubramanian
J2EE Application Development
Web-Services-based Systems Architecture, Design and Implementation
Understanding and Designing with EJB
Objectives In this lesson, you will learn to:
Objectives In this lesson you will learn about: Need for servlets
Understanding and Designing with EJB
Enterprise Java Beans Bina Ramamurthy 1/13/2019 B.Ramamurthy.
Understanding and Designing with EJB
Enterprise Java Beans Bina Ramamurthy 4/5/2019 B.Ramamurthy.
Enterprise Java Beans.
Knowledge Byte In this section, you will learn about:
Presentation transcript:

4-Tier Model Client Tier Web Tier Business Tier EIS Tier

Run 4-Tier KWIC Project on J2EE Platform Preparation Packaging –Creating the J2EE Application (.ear) –Creating the Enterprise Bean (.jar) –Creating the Web Client (.war) Deploying Running

Preparation Set Environment Variables –JAVA_HOME = root directory of J2SE SDK installation –J2EE_HOME = root directory of J2EE SDK installation –PATH = %PATH%;%JAVA_HOME%\bin;%J2EE_HOME%\bin –CLASSPATH = %CLASSPATH%;%J2EE_HOME%\lib\j2ee.jar

Preparation Start Cloudscape database server. –C:\> cloudscape –start Start J2EE server –C:\> j2ee –verbose Start deploytool –C:\> deploytool Build the database table –C:\> cloudscape –isql WebAddressAccount urlName (PK) urlDescription

Packaging Create an Enterprise Archive (EAR) file –ProjectApp.ear Add Java Archive (JAR) files and Web Archive (WAR) files to the EAR –WebAddressAccountJAR: contains the enterprise bean files and related files –ProjectWAR: contains the Web Component files and related files

An enterprise bean is a server-side component that contains the business logic of an application Writes and compiles the source code Packages the bean’s classes into EJB JAR file –Remote Interface –Home Interface –Enterprise Bean Class Creating Enterprise Bean Remote Client Remote Interface Home Interface EJB

Remote Interface WebAddressAccount.java –defines the business methods that a client may call. The business methods are implemented in the enterprise bean code public interface WebAddressAccount extends EJBObject { public String getUrlName(); public String getUrlDescript(); }

Home Interface WebAddressAccountHome.java –defines the methods that allow a client to create, find, or remove an enterprise bean public interface WebAddressAccountHome extends EJBHome { public WebAddressAccount create(String urlName, String urlDescript); public WebAddressAccount findByPrimaryKey(String urlName) ; }

Enterprise Bean Class WebAddressAccountBean.java –implements the business methods public class WebAddressAccountBean implements EntityBean { public String getUrlName() { return urlName;} public String getUrlDescript() { return urlDescript; } public String ejbCreate( String urlName, String urlDescript) { insertRow( urlName, urlDescript); } public String ejbFindByPrimaryKey(String primaryKey) { result = selectByPrimaryKey(primaryKey); }

/*********************** Database Routines *************************/ private void makeConnection() { InitialContext ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup(“java:comp/env/jdbc/WebAddressAccountDB”); con = ds.getConnection(); } private void insertRow ( String urlName, String urlDescript) { PreparedStatement prepStmt = con.prepareStatement("insert into webAddressaccount values ( ?, ? )"); prepStmt.setString(1, urlName); prepStmt.setString(2, urlDescript); prepStmt.executeUpdate(); prepStmt.close(); }

Creating Web Component When web client such as browser communicates with J2EE application, it dose so through server- side objects called Web components Writes and compiles the source code Bundles the.class,.jsp,.html files into WAR file

Source Codes URLListener.java URLEventObject.javaFindHandler.jsp Find.jsp KeyWordSearch.javaAlphabetizer.jsp Alphabetizer.javaCShiftLines.jspMenuFrame.html CShiftLines.javaSaveHandler.jspWelcome.html DetailURL.javaSave.jspindex.html JavaBeanJSPHTML SearchHistory.java

Web Client save.jsp CShiftLines.jsp saveHandle.jsp Alphabetizer.jsp find.jsp findHandle.jsp WebAddress AccountBean webaddressaccount DetailURL CShiftLine Alphabetizer KeyWordSearch SaveHistory Web Container EJB Container

JSP Syntax Include Declaration Scriptlet Expression

–Locating the home interface Object objRef = ic.lookup("java:comp/env/ejb/TheWebAddressAccount"); WebAddressAccountHome home = PortableRemoteObject.narrow(objRef, WebAddressAccountHome.class); –Creating an Enterprise Bean Instance WebAddressAccount joe = home.create( url_name, url_descript); –Invoking business methods WebAddressAccount findone = home.findByPrimaryKey(oneURLName); findone.getUrlDescript();

JNDI Names and Resource References JNDI: Java Naming and Directory Interface J2EE components locate objects by invoking the JNDI lookup method The JNDI name of a resource and the name of the resource reference are not the same This approach to naming requires that you map the two names before deployment

Specifying a Resource Reference The WebAddressAccountBean code refers to the database as follows: private String dbName = "java:comp/env/jdbc/WebAddressAccountDB";

Mapping Resource Reference to JNDI Name

Specifying a Resource Reference In lookup methods, the Web client refers to the home of an enterprise bean: Object objRef = ic.lookup("java:comp/env/ejb/TheWebAddressAccount ");

Mapping Resource Reference to JNDI Name

Deploying Select Tools -> Deploy In the JNDI Names dialog box, verify the names In the WAR Context Root dialog box, enter kwicProject in the Context Root field, which will be part of the URL

Running Change the default port number (8000) by editing the Config/web.properties file

Modifying the J2EE Application Change the source code Recompile it Redeploy the application –Select Tools -> Update Files –Select Tools -> Deploy Or –Select Tools -> Update And Redeploy