J2EE-Overview

Views:
 
Category: Entertainment
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

J2EE Overview:

J2EE Overview

Presentation Overview:

Presentation Overview Introduction to J2EE Explain the major technologies within the J2EE designation J2EE applications J2EE servers

The Java 2 Platform:

The Java 2 Platform Platform introduced June, 1999 J2SE – Java 2 Standard Edition Java for the desktop / workstation J2ME – Java 2 Micro Edition Java for the consumer device J2EE - Java 2 Enterprise Edition Java for the server

The Java 2 Platform:

The Java 2 Platform

J2EE Technologies:

J2EE Technologies Java Servlets JSP EJB JMS JDBC JNDI JTA / JTS Java Mail JAAS XML …

J2EE Components:

J2EE Components

Java Servlets:

Java Servlets Servlets are the Java platform technology of choice for extending and enhancing web servers. Servlets provide a component-based, platform-independent method for building web-based applications, without the performance limitations of CGI programs.

Java Servlets:

Java Servlets Servlets have access to the entire family of Java APIs, including the JDBC API to access enterprise databases. Servlets can also access a library of HTTP-specific calls and receive all the benefits of the mature Java language, including portability, performance, reusability, and crash protection

Anatomy of a Servlet:

Anatomy of a Servlet init() – the init() function is called when the servlet is initialized by the server. This often happens on the first doGet() or doPut() call of the servlet. destroy() – this function is called when the servlet is being destroyed by the server, typically when the server process is being stopped.

Anatomy of a Servlet:

Anatomy of a Servlet doGet() – the doGet() function is called when the servlet is called via an HTTP GET. doPost() – the doPost() function is called when the servlet is called via an HTTP POST. POSTs are a good way to get input from HTML forms

Anatomy of a Servlet:

Anatomy of a Servlet HTTPServletRequest object Information about an HTTP request Headers Query String Session Cookies HTTPServletResponse object Used for formatting an HTTP response Headers Status codes Cookies

Sample Servlet :

Sample Servlet import java.io.*; import javax.servlet .*; import javax.servlet.http .*; public class HelloWorld extends HttpServlet { public void doGet ( HttpServletRequest request, HttpServletResponse response) throws IOException , ServletException { response.setContentType (" text/html "); PrintWriter out = response.getWriter (); out.println (" <html> "); out.println (" <body> "); out.println (" <head> "); out.println (" <title>Hello World!</title> "); out.println (" </head> "); out.println (" <body> "); out.println (" <h1>Hello World!</h1> "); out.println (" </body> "); out.println (" </html> "); } }

JSP – JavaServer Pages:

JSP – JavaServer Pages JavaServer Pages technology uses XML-like tags and scriptlets written in the Java programming language to encapsulate the logic that generates the content for the page. Any and all formatting (HTML or XML) tags are passed directly back to the response page. By separating the page logic from its design and display and supporting a reusable component-based design, JSP technology makes it faster and easier than ever to build web-based applications.

Sample JSP:

Sample JSP <html> <body bgcolor="white"> <jsp:useBean id='clock' scope='page' class='dates.JspCalendar' type="dates.JspCalendar" /> <font size=4><ul> <li> Day of month: is <jsp:getProperty name="clock" property="dayOfMonth"/> <li> Year: is <jsp:getProperty name="clock" property="year"/> <li> Month: is <jsp:getProperty name="clock" property="month"/> <li> Time: is <jsp:getProperty name="clock" property="time"/> <li> Date: is <jsp:getProperty name="clock" property="date"/> <li> Day: is <jsp:getProperty name="clock" property="day"/> <li> Day Of Year: is <jsp:getProperty name="clock" property="dayOfYear"/> <li> Week Of Year: is <jsp:getProperty name="clock" property="weekOfYear"/> <li> era: is <jsp:getProperty name="clock" property="era"/> <li> DST Offset: is <jsp:getProperty name="clock" property="DSTOffset"/> <li> Zone Offset: is <jsp:getProperty name="clock" property="zoneOffset"/> </ul> </font> </body> </html>

EJB – Enterprise Java Beans:

EJB – Enterprise Java Beans Enterprise JavaBeans M is the server-side component architecture for the J2EE Platform. EJB enables rapid and simplified development of distributed, transactional, secure and portable Java applications. Current Specification: 3.0

EJB – Enterprise Java Beans:

EJB – Enterprise Java Beans Enterprise Java Beans are components that are deployed into containers The container provides services Loading / Initialization Transactions Persistence Communication with EJB clients Enterprise Naming Context (JNDI name space)

Client / EJB Relationship:

Client / EJB Relationship EJBs utilization by client application (Java class) Lookup - JNDI ENC Network protocol - RMI EJB container creates object with RemoteHome and Home interfaces – this object passes calls to the bean class

EJB – Enterprise Java Beans:

EJB – Enterprise Java Beans Entity Beans Session Beans Message Beans New in EJB 3.0

EJB – Entity Beans:

EJB – Entity Beans Entity beans are classes that map to individual entities – typically, an Entity bean references a row in a database table, providing an object representation of that database object. For example, an entity bean could represent a customer, and changing the values in that entity bean would cause updates to that database row Entity beans provide an abstraction layer so that working with the entity is not specific to the storage mechanism for that entity.

Entity Beans - Persistence:

Entity Beans - Persistence Container Managed Persistence (CMP) The EJB container automatically persists the EJB objects, usually to a relational database where each type of object is represented as a table, and each instance of the object is a row in that table Bean Managed Persistence (BMP) The EJB container calls bean methods when it is appropriate for the bean to load, save or update data, enforcing transactions without transaction code written by the bean developer

EJB – Session Beans:

EJB – Session Beans Session beans perform work for a client application For example, a session bean could charge a credit card for a specific transaction.

Session Beans – State:

Session Beans – State Stateful – A stateful bean maintains a conversational state with a client. The client perceives that it is only talking to one bean, and that bean maintains information between calls Stateless – A stateless bean maintains no client information between method calls – the container can substitute beans as necessary between method calls

EJB – Message Beans:

EJB – Message Beans Message beans are classes that receive asynchronous notification from a Java Message Service server For example, a message bean could be activated when vendor sends a purchase order to a JMS queue.

JMS – Java Message Service:

JMS – Java Message Service Enterprise messaging provides a reliable, flexible service for the asynchronous exchange of critical business data and events throughout an enterprise. The JMS API adds to this a common API and provider framework that enables the development of portable, message based applications in the Java programming language.

JMS – Java Message Service:

JMS – Java Message Service JMS Queue JMS Topic

JMS – Java Message Service:

JMS – Java Message Service JMS Usage Loosely-coupled systems Connectionless Removes dependence on client and server platform / programming language / version Publish / Subscribe metaphor Send / receive information with many, unknown clients Integration with other messaging systems IBM MQ-Series Microsoft Message Queue

J2EE Connectors:

J2EE Connectors The J2EE Connector architecture defines a standard architecture for connecting the J2EE platform to heterogeneous EISs (Enterprise Information Systems). Examples of EISs include ERP, mainframe transaction processing, database systems, and legacy applications not written in the Java programming language.

J2EE Applications:

J2EE Applications

J2EE Deployment:

J2EE Deployment JAR – Java ARchive Java class file EJBs WAR - Web ARchive Servlets JSPs EAR - Enterprise ARchive Contains other JARs and WARs to form an entire application Deployment descriptors XML Required for EJB JARs, WARs, EARs

J2EE Servers:

J2EE Servers Application Server As of Sept ’01 - MetaGroup Survey by sales $$ BEA Weblogic - 37% IBM Websphere – 22% Oracle – 11% Iplanet – 5% Other- 12% Open-source Jboss – www.jboss.org Sun’s listing of J2EE compatible servers - http://java.sun.com/j2ee/compatibility.html

J2EE Servers:

J2EE Servers Servlet / JSP Servers Most of the commercial application servers also include servlet / JSP support Open-Source Apache Tomcat Jetty Sun’s listing of servlet / JSP servers - http://java.sun.com/products/servlet/industry.html

J2EE Development Tools:

J2EE Development Tools Major IDEs support J2EE in some form Wizards for EJB / Servlets Custom editors for JSP Deployment descriptor support Deployment support for application servers Embedded servers for testing within IDE

Learning more…:

Learning more… Enterprise JavaBeans – 3 rd Edition Richard Monson-Haefel O’Reilly © 2001 JBoss documentation http://www.jboss.org/online-manual/HTML/index.html Designing Enterprise Applications with the Java 2 Platform, Enterprise Edition Nicholas Kassem and the Enterprise Team Addison Wesley © 2000 Core Servlets and JavaServer Pages (JSP) Marty Hall Prentice Hall © 2000

Learning more…:

Learning more… J2EE Tutorial - http://java.sun.com/j2ee/tutorial/1_3-fcs J2EE Developers Guide - http://java.sun.com/j2ee/sdk_1.2.1/techdocs/guides/ejb/html/DevGuideTOC.html JNDI - http://java.sun.com/products/jndi/tutorial/ JMS - http://java.sun.com/products/jms/tutorial/ JDBC - http://java.sun.com/docs/books/tutorial/jdbc Servlets - http://java.sun.com/docs/books/tutorial/servlets JSP - http://java.sun.com/products/jsp/docs.html JAXP - http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial

authorStream Live Help