J2EE Web Development. Agenda. Application servers. What is J2EE? Main component types Application Scenarios J2EE APIs and Services.

Similar documents
Java 2 Platform, Enterprise Edition (J2EE) Bruno Souza Java Technologist, Sun Microsystems, Inc.

Internet Engineering: Web Application Architecture. Ali Kamandi Sharif University of Technology Fall 2007

Java E-Commerce Martin Cooke,

Java 2 Platform, Enterprise Edition (J2EE): Enabling Technologies for EAI

An introduction to web programming with Java

How to Build an E-Commerce Application using J2EE. Carol McDonald Code Camp Engineer

Introduction to J2EE Web Technologies

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java

Oracle WebLogic Foundation of Oracle Fusion Middleware. Lawrence Manickam Toyork Systems Inc

Building Web Applications, Servlets, JSP and JDBC

Glassfish, JAVA EE, Servlets, JSP, EJB

Creating Java EE Applications and Servlets with IntelliJ IDEA

Client-Server Architecture & J2EE Platform Technologies Overview Ahmed K. Ezzat

What Is the Java TM 2 Platform, Enterprise Edition?

7 Web Databases. Access to Web Databases: Servlets, Applets. Java Server Pages PHP, PEAR. Languages: Java, PHP, Python,...

The Comparison of J2EE and.net for e-business

Database Applications Recitation 10. Project 3: CMUQFlix CMUQ s Movies Recommendation System

Modeling Presentation Layers of Web Applications for Testing

Web Application Programmer's Guide

Agenda. Summary of Previous Session. Application Servers G Session 3 - Main Theme Page-Based Application Servers (Part II)

How To Protect Your Computer From Being Hacked On A J2Ee Application (J2Ee) On A Pc Or Macbook Or Macintosh (Jvee) On An Ipo (J 2Ee) (Jpe) On Pc Or

Automatic generation of distributed dynamic applications in a thin client environment

CGI Vs. Java - Which is Better For Marketing

ACM Crossroads Student Magazine The ACM's First Electronic Publication

3-Tier Architecture. 3-Tier Architecture. Prepared By. Channu Kambalyal. Page 1 of 19

WebSphere Application Server - Introduction, Monitoring Tools, & Administration

EJB & J2EE. Component Technology with thanks to Jim Dowling. Components. Problems with Previous Paradigms. What EJB Accomplishes

Portals, Portlets & Liferay Platform

MVC pattern in java web programming

Getting Started with Web Applications

Enterprise Applications

SAP Web Application Server 6.30: Learning Map for Development Consultants

IBM Rational Rapid Developer Components & Web Services

White paper. IBM WebSphere Application Server architecture

era J2EE Platform and Tool Recommendations

2012 LABVANTAGE Solutions, Inc. All Rights Reserved.

Implementing the Shop with EJB

White Paper: 1) Architecture Objectives: The primary objective of this architecture is to meet the. 2) Architecture Explanation

Oracle WebLogic Server

<Insert Picture Here> Betting Big on JavaServer Faces: Components, Tools, and Tricks

An introduction to creating JSF applications in Rational Application Developer Version 8.0

Implementation of an Enterprise-level Groupware System Based on J2EE Platform and WebDAV Protocol

Web Services and Application Frameworks (.NET and J2EE)

Contents. Client-server and multi-tier architectures. The Java 2 Enterprise Edition (J2EE) platform

Tutorial: Building a Web Application with Struts

Java-technology based projects

Expert One-on-One J2EE Design and Development

ICS 434 Advanced Database Systems

Introduction to Sun ONE Application Server 7

Developing a J2EE Application. Web Auction. Gerald Mo

The Duke s Bank Application

Web Container Components Servlet JSP Tag Libraries

DTS Web Developers Guide

BAPI. Business Application Programming Interface. Compiled by Y R Nagesh 1

JSP Java Server Pages

Systems Integration in the Cloud Era with Apache Camel. Kai Wähner, Principal Consultant

How To Write A Bean In Java (Java) (Java 2.4.2) (Java.Net) (Javax) 2 (Java Bean) ( Java Bean) 2-4.5

CrownPeak Java Web Hosting. Version 0.20

Form Handling. Server-side Web Development and Programming. Form Handling. Server Page Model. Form data appended to request string

AN OVERVIEW OF SERVLET AND JSP TECHNOLOGY

Oracle Application Server 10g

Java Server Pages combined with servlets in action. Generals. Java Servlets

Java EE 6 Ce qui vous attends

JReport Server Deployment Scenarios

JAVA/J2EE DEVELOPER RESUME

SOFT 437. Software Performance Analysis. Ch 5:Web Applications and Other Distributed Systems

The end. Carl Nettelblad

Web Programming II JSP (Java Server Pages) ASP request processing. The Problem. The Problem. Enterprise Application Development using J2EE

Web Development with the Eclipse Platform

Developing XML Solutions with JavaServer Pages Technology

JEE Web Applications Jeff Zhuk

Performance Comparison of Java Application Servers

Enterprise Integration Architectures for the Financial Services and Insurance Industries

Enterprise JavaBeans Fundamentals

Complete Java Web Development

Web Development in Java

Chapter 2 TOPOLOGY SELECTION. SYS-ED/ Computer Education Techniques, Inc.

WebSphere Portal, Portlets and Web Services

Intellicus Single Sign-on

CACHÉ: FLEXIBLE, HIGH-PERFORMANCE PERSISTENCE FOR JAVA APPLICATIONS

Agenda. Web Development in Java. More information. Warning

Design Approaches of Web Application with Efficient Performance in JAVA

How to make a good Software Requirement Specification(SRS)

ON-LINE BOOKING APPLICATION NEIL TAIT

WebSphere Server Administration Course

EJB 3.0 and IIOP.NET. Table of contents. Stefan Jäger / stefanjaeger@bluewin.ch

IBM WebSphere Server Administration

.NET 3.0 vs. IBM WebSphere 6.1 Benchmark Results

Transcription:

J2EE Web Development Agenda Application servers What is J2EE? Main component types Application Scenarios J2EE APIs and Services Examples 1

1. Application Servers In the beginning, there was darkness and cold. Then, mainframe terminals terminals Centralized, non-distributed Application Servers In the 90 s, systems should be clientserver 2

Application Servers Today, enterprise applications use the multi-tier model Application Servers Multi-tier applications have several independent components An application server provides the infrastructure and services to run such applications 3

Application Servers Application server products can be separated into 3 categories: J2EE-based solutions Non-J2EE solutions (PHP, ColdFusion, Perl, etc.) And the Microsoft solution (ASP/COM and now.net with ASP.NET, VB.NET, C#, etc.) J2EE Application Servers Major J2EE products: BEA WebLogic IBM WebSphere Jboss (free open source) 4

Web Server and Application Server Internet Browser App Server 1 Web Server (HTTP Server) HTTP(S) App Server 2 2. What is J2EE? It is a public specification that embodies several technologies J2EE defines a model for developing multi-tier, web based, enterprise applications with distributed components 5

J2EE Benefits High availability Scalability Integration with existing systems Freedom to choose vendors of application servers, tools, components Multi-platform J2EE Benefits Flexibility of scenarios and support to several types of clients Programming productivity: Services allow developer to focus on business Component development facilitates maintenance and reuse Enables deploy-time behaviors Supports division of labor 6

Main technologies JavaServer Pages (JSP) Servlet Enterprise JavaBeans (EJB) JSPs, servlets and EJBs are application components JSP Used for web pages with dynamic content Processes HTTP requests (non-blocking call-and-return) Accepts HTML tags, special JSP tags, and scriptlets of Java code Separates static content from presentation logic Can be created by web designer using HTML tools 7

Servlet Used for web pages with dynamic content Processes HTTP requests (non-blocking calland-return) Written in Java; uses print statements to render HTML Loaded into memory once and then called many times Provides APIs for session management EJB EJBs are distributed components used to implement business logic (no UI) Developer concentrates on business logic Availability, scalability, security, interoperability and integrability handled by the J2EE server Client of EJBs can be JSPs, servlets, other EJBs and external aplications Clients see interfaces 8

J2EE Multi-tier Model J2EE Application Scenarios Multi-tier typical application 9

J2EE Application Scenarios Stand-alone client J2EE Application Scenarios Web-centric application 10

J2EE Application Scenarios Business-to-business J2EE Services and APIs JDBC JavaMail Java API for XML Parsing (JAXP) Web services APIs 11

Types of EJB SessionBean Stateful Stateless EJB Taxonomy EnterpriseBean EntityBean BMP CMP MessageDrivenBean Session Bean Stateful session bean: Retains conversational state (data) on behalf of an individual client If state changed during this invocation, the same state will be available upon the following invocation Example: shopping cart 12

Session Bean Stateless session bean: Contains no user-specific data Business process that provides a generic service Container can pool stateless beans Example: shopping catalog Entity Bean Represents business data stored in a database persistent object Underlying data is normally one row of a table A primary key uniquely identifies each bean instance Allows shared access from multiple clients Can live past the duration of client s session Example: shopping order 13

Entity Bean Bean-managed persistence (BMP): bean developer writes JDBC code to access the database; allows better control for the developer Container-managed persistence (CMP): container generates all JDBC code to access the database; developer has less code to write, but also less control 3. Examples JSP example Servlet example EJB example 14

JSP example JSP example <%@ page import="hello.greeting" %> <jsp:usebean id="mybean" scope="page" class="hello.greeting"/> <jsp:setproperty name="mybean" property="*" /> <html> <head><title>hello, User</title></head> <body bgcolor="#ffffff" background="background.gif"> <%@ include file="dukebanner.html" %> <table border="0" width="700"> <tr> <td width="150"> </td> <td width="550"> <h1>my name is Duke. What's yours?</h1> </td> </tr> 15

JSP example <tr> <td width="150" </td> <td width="550"> <form method="get"> <input type="text" name="username" size="25"> <br> <input type="submit" value="submit"> <input type="reset" value="reset"> </td> </tr> </form> </table> <% if (request.getparameter("username")!= null) { %> <%@ include file="response.jsp" %> <% %> </body> </html> Servlet example public class HelloWorldServlet extends HttpServlet { public void service(httpservletrequest req, HttpServletResponse res) throws IOException { res.setcontenttype("text/html"); PrintWriter out = res.getwriter(); out.println("<html><head><title>hello World Servlet</title></head>"); out.println("<body><h1>hello World!</h1></body></html>"); 16

EJB Example // Shopping Cart example // Home interface public interface CartHome extends EJBHome { Cart create(string person) throws RemoteException, CreateException; Cart create(string person, String id) throws RemoteException, CreateException; EJB Example // Remote interface public interface Cart extends EJBObject { public void addbook(string title) throws RemoteException; public void removebook(string title) throws BookException, RemoteException; public Vector getcontents() throws RemoteException; 17

EJB Example // Enterprise bean class public class CartEJB implements SessionBean { String customername, customerid; Vector contents; private SessionContext sc; public void ejbcreate(string person) throws CreateException { if (person == null) { throw new CreateException("Null person not allowed."); else { customername = person; customerid = "0"; contents = new Vector(); EJB Example public void ejbcreate(string person, String id) throws CreateException { if (person == null) { throw new CreateException("Null person not allowed."); else { customername = person; IdVerifier idchecker = new IdVerifier(); if (idchecker.validate(id)) { customerid = id; else { throw new CreateException("Invalid id: " + id); contents = new Vector(); 18

EJB Example public void addbook(string title) { contents. addelement(title); public void removebook(string title) throws BookException { boolean result = contents.removeelement(title); if (result == false) { throw new BookException(title + " not in cart."); public Vector getcontents() { return contents;... EJB Example // EJB client (stand-alone application) public class CartClient { public static void main(string[] args) { try { CartHome home = (CartHome)initial.lookup("MyCart"); Cart shoppingcart = home.create("duke DeEarl", "123"); shoppingcart.addbook("the Martian Chronicles"); shoppingcart.addbook("2001 A Space Odyssey"); shoppingcart.remove(); catch (BookException ex) { System.err.println("Caught a BookException: " + ex.getmessage()); catch (Exception ex) { System.err.println("Caught an unexpected exception!"); 19

Questions 20