17 Copyright © 2004, Oracle. All rights reserved. Integrating J2EE Components.

Slides:



Advertisements
Similar presentations
Communicating in J2EE.
Advertisements

19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services.
21 Copyright © 2005, Oracle. All rights reserved. Oracle Application Server 10g Transaction Support.
12 Copyright © 2005, Oracle. All rights reserved. Implementing Business Tasks with Session EJBs.
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
7 Copyright © 2005, Oracle. All rights reserved. Maintaining State in J2EE Applications.
5 Copyright © 2005, Oracle. All rights reserved. Accessing the Database with Servlets.
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
9 Copyright © 2005, Oracle. All rights reserved. Modularizing JavaServer Pages Development with Tags.
8 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: JavaServer Pages.
J2EE Overview.
6 Copyright © 2005, Oracle. All rights reserved. Building Applications with Oracle JDeveloper 10g.
JSP and web applications
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Advanced Java Server Pages An more detailed look at JSPs.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
Java 2 – Enterprise Edition Kevin J. LaFata April 21, 2003 UM – St. Louis.
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
Current Topics in Programming Languages Lecture 15_1 George Koutsogiannakis SUMMER
Java Enterprise Edition Java Web Development Structure of a web project Introduction to Web Applications The first project Introduction to Java Web Development.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 37 - JavaServer Pages (JSP): Bonus for Java Developers Outline 37.1 Introduction 37.2 JavaServer.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
4-Tier Model Client Tier Web Tier Business Tier EIS Tier.
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.
CSC 2720 Building Web Applications Using Java Beans, Custom Tags and Tag Libraries in JSP pages.
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
® IBM Software Group © 2007 IBM Corporation JSP Custom Tags
Introduction to JavaServer Pages (JSP) Slides from Dr. Mark Llewellyn.
Introduction to J2EE Architecture Portions by Kunal Mehta.
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,
Struts J2EE web application framework “ Model 2 ” Model View Controller Controller Servlet Key features XML metadata Struts taglib Simplified form validation.
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)
JSP Fundamentals Elements of a JSP Using Beans with JSP Integrating Servlets and JSP.
JSP Tag Libraries Lec Last Lecture Example We incorporated JavaBeans in “Course Outline” Example But still have to write java code inside java.jsp.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
Java Server Pages (JSP)
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.
JSP Custom Tags. Prerequisites Servlet API Mapping to JSP implicit objects JavaServer Pages Basic syntax Implementation via servlet API XML.
Java Enterprise Edition Programming Page 1 of 9Configuring Servlets Web Application Context Name  In multiple web applications, a “context name” is used.
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 1COMP9321, 15s2, Week.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
13 Copyright © 2004, Oracle. All rights reserved. Adding Validation and Error Handling.
Preface 1Introduction Course Objectives 1-2 Course Environment 1-4 Course Overview 1-5 About the Course Applications 1-8 Order Entry Schema 1-9 Human Resources.
11 Copyright © 2004, Oracle. All rights reserved. Customizing Actions.
14 Copyright © 2004, Oracle. All rights reserved. Enhancing the User Interface.
17 Copyright © 2004, Oracle. All rights reserved. Deploying an ADF Application.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
15 Copyright © 2004, Oracle. All rights reserved. Adding JAAS Security to the Client.
13 Copyright © 2004, Oracle. All rights reserved. Managing Persistent Data in the Business Tier Entity EJBs.
©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.
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
Securing Web Applications Lesson 4B / Slide 1 of 34 J2EE Web Components Pre-assessment Questions 1. Identify the correct return type returned by the doStartTag()
2 Copyright © 2004, Oracle. All rights reserved. ADF Development Process.
12 Copyright © 2004, Oracle. All rights reserved. Using ADF Struts Components.
14 Copyright © 2004, Oracle. All rights reserved. Achieving State Management in the Business Tier.
Speaker Name Speaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation Building Servlet and JSP Applications.
©NIIT Session Beans Lesson 1B/ Slide 1 of 37J2EE Server Components Objectives In this lesson, you will learn to: Describe the characteristics of session.
Java Servlets By: Tejashri Udavant..
Knowledge Byte In this section, you will learn about:
J2EE Application Development
Understanding and Designing with EJB
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
Objectives In this lesson, you will learn to:
Presentation transcript:

17 Copyright © 2004, Oracle. All rights reserved. Integrating J2EE Components

17-2 Copyright © 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Create JavaServer Pages (JSP) clients for EJBs Use Enterprise JavaBeans (EJB) tags in JSPs Modify the configuration files in OracleAS 10g Containers for J2EE (OC4J)

17-3 Copyright © 2004, Oracle. All rights reserved. Overview JSP HttpServlet Request Web tier EJB tier Controller servlet Employees JSP Employees EJB To EIS HttpServlet Response

17-4 Copyright © 2004, Oracle. All rights reserved. Creating Remote Clients for EJBs To create a remote JSP client for an Enterprise JavaBean, perform the following steps : 1.Import the EJB home interface. 2.Override the jspInit() method. –Use the lookup() method to create a reference to the EJB. –Create the EJB remote object. 3.Retrieve the necessary parameters from the request object and pass the parameters to the EJB method. 4.Define a reference to the EJB in the web.xml file.

17-5 Copyright © 2004, Oracle. All rights reserved. Importing the EJB Home Interface Use the page directive to import the naming package and the home interface for the EJB:

17-6 Copyright © 2004, Oracle. All rights reserved. Create a Reference to the EJB To create an EJB reference, use the lookup method. Override the jspInit() method as follows: <%! Employees employees = null; public void jspInit() { try { InitialContext ic = new InitialContext(); EmployeesHome employeesHome = (EmployeesHome) PortableRemoteObject.narrow (ic.lookup("java:comp/env/Employees"), EmployeesHome.class); employees = employeesHome.create(); } catch (RemoteException ex) { ex.printStackTrace(); } } %>

17-7 Copyright © 2004, Oracle. All rights reserved. Passing Arguments to the EJB Method Calling an EJB method from a JSP expression evaluates the return value of the EJB method and displays it, as follows: Insert an Employee Number: <% String empno = request.getParameter("empno"); if (empno != null && empno.length() >0) { int i = Integer.parseInt(empno);%>

17-8 Copyright © 2004, Oracle. All rights reserved. Creating an EJB Reference To obtain an EJB reference for the Web tier components, create an element for the EJB in the web.xml file:

17-9 Copyright © 2004, Oracle. All rights reserved. Creating Local Clients for EJBs Creating JSP clients for local EJBs is similar to creating remote clients, with the following exceptions: The EJB object does not have to be cast to a PortableRemoteObject. Because the create() method does not throw a RemoteException exception, this does not have to be caught in the client. Instead of, an element is created in the client web.xml file.

17-10 Copyright © 2004, Oracle. All rights reserved. ejb-local-ref Element Right-click web.xml to create an EJB local reference.

17-11 Copyright © 2004, Oracle. All rights reserved. EJB Tags Oracle Application Server 10g provides a tag library that contains custom tags for referencing EJBs in JSPs: EJB Tag Purpose useHome Looks up the home interface for the EJB and creates an instance of it useBean Instantiates the EJB createBean Nests an EJB createBean tag within the useBean tag to create the EJB instance iterate Iterates through a collection of EJB instances

17-12 Copyright © 2004, Oracle. All rights reserved. useHome Tag The useHome tag has no body. The attributes are: id (required) type (required) location (required)

17-13 Copyright © 2004, Oracle. All rights reserved. useBean Tag The attributes of the useBean tag include: id (required) type (required) value scope

17-14 Copyright © 2004, Oracle. All rights reserved. createBean Tag The createBean tag contains only one required attribute named instance. " />

17-15 Copyright © 2004, Oracle. All rights reserved. iterate Tag The following are the attributes of the iterate tag: id (required) type (required) collection (required) max " max="100">

17-16 Copyright © 2004, Oracle. All rights reserved. Using the EJB Tags To use the EJB tags, perform the following steps: 1.Add the Oracle9 i AS library to your project in JDeveloper. a. Double-click the project and select libraries. b. Make sure that “Oracle9 i AS” is included in your project. 2.Use the OJSP EJB Library provided in the component palette to add the necessary tags to your JSP file. (This adds the bean as well as the taglib directive to the JSP.)

17-17 Copyright © 2004, Oracle. All rights reserved. Deploying an Application: Web Tier To deploy the Web tier components of a Java 2, Enterprise Edition (J2EE) application, perform the following steps: 1.Make sure that the ejb-ref or ejb-local-ref elements exist in the web.xml file. 2.Create a WAR deployment profile (.deploy ) in JDeveloper. 3.Right-click the.deploy file and select either of the following: –Deploy to WAR file –Deploy to OracleAS10g (where OracleAS10g is the name of your application server connection)

17-18 Copyright © 2004, Oracle. All rights reserved. Deploying an Application: EJB Tier 1.Make sure that the ejb-jar.xml file contains unique mappings for each EJB in the application. 2.Create a JAR deployment profile (.deploy ) in JDeveloper. 3.Right-click the.deploy file and select either of the following: –Deploy to JAR file –Deploy to OracleAS10g

17-19 Copyright © 2004, Oracle. All rights reserved. Deploying an Application: EAR File 1.Create an EAR file in JDeveloper. 2.Specify the EJB JAR and WAR files that are to be included in this EAR file. 3.Right-click the.deploy file and select either of the following: –Deploy to EAR file –Deploy to OracleAS10g

17-20 Copyright © 2004, Oracle. All rights reserved. Deploying from Oracle Enterprise Manager From the Enterprise Manager home page, click Home, then Application, and then select Deploy EAR file:

17-21 Copyright © 2004, Oracle. All rights reserved. Summary In this lesson, you should have learned how to: Create JSP clients for EJBs Modify deployment descriptors for looking up an EJB client Deploy a J2EE application to Oracle Application Server 10g

17-22 Copyright © 2004, Oracle. All rights reserved. Practice 17-1 and 17-2: Overview These practices cover the following topics: Creating JSP clients that access EJBs Deploying a Web application to Oracle Application Server 10g

17-23 Copyright © 2004, Oracle. All rights reserved.

17-24 Copyright © 2004, Oracle. All rights reserved.

17-25 Copyright © 2004, Oracle. All rights reserved.

17-26 Copyright © 2004, Oracle. All rights reserved.

17-27 Copyright © 2004, Oracle. All rights reserved.

17-28 Copyright © 2004, Oracle. All rights reserved.