CS 55.17. Developing Web Applications with Java Technologies

Similar documents
2011 Marty Hall An Overview of Servlet & JSP Technology Customized Java EE Training:

What servlets and JSP are all about

Glassfish, JAVA EE, Servlets, JSP, EJB

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

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

An Overview of Servlet & JSP Technology

Volume 1: Core Technologies Marty Hall Larry Brown. An Overview of Servlet & JSP Technology

& JSP Technology Originals of Slides and Source Code for Examples:

CrownPeak Java Web Hosting. Version 0.20

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

What Is the Java TM 2 Platform, Enterprise Edition?

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

In this chapter, we lay the foundation for all our further discussions. We start

Client/server is a network architecture that divides functions into client and server

NetBeans IDE Field Guide

B. WEB APPLICATION ARCHITECTURE MODELS

Building Web Applications, Servlets, JSP and JDBC

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

Java-technology based projects

SOFTWARE ARCHITECTURE FOR FIJI NATIONAL UNIVERSITY CAMPUS INFORMATION SYSTEMS

OUR COURSES 19 November All prices are per person in Swedish Krona. Solid Beans AB Kungsgatan Göteborg Sweden

White paper. IBM WebSphere Application Server architecture

Web Applications. For live Java training, please see training courses at

JReport Server Deployment Scenarios

Virtual Credit Card Processing System

Case Studies of Running the Platform. NetBeans UML Servlet JSP GlassFish EJB

Portals, Portlets & Liferay Platform

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

Design Approaches of Web Application with Efficient Performance in JAVA

Course Name: Course in JSP Course Code: P5

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

Debugging Ajax Pages: Firebug

A framework for web-based product data management using J2EE

Modern Software Development Tools on OpenVMS

JBS-102: Jboss Application Server Administration. Course Length: 4 days

HPC Portal Development Platform with E-Business and HPC Portlets

ON-LINE BOOKING APPLICATION NEIL TAIT

Crystal Reports for Eclipse

SSC - Web development Model-View-Controller for Java web application development

Customer Bank Account Management System Technical Specification Document

Learning GlassFish for Tomcat Users

Introduction to Sun ONE Application Server 7

Using Tomcat with CA Clarity PPM

Exam Name: IBM InfoSphere MDM Server v9.0

Web Application Development

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

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

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

Japan Communication India Skill Development Center

Developing XML Solutions with JavaServer Pages Technology

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

Brocade Virtual Traffic Manager and Oracle EBS 12.1 Deployment Guide

Architectural Overview

Stock Trader System. Architecture Description

Java with Eclipse: Setup & Getting Started

Workshop for WebLogic introduces new tools in support of Java EE 5.0 standards. The support for Java EE5 includes the following technologies:

T320 E-business technologies: foundations and practice

Building Java Servlets with Oracle JDeveloper

3. Installation and Configuration. 3.1 Java Development Kit (JDK)

Distributed Objects and Components

Android Programming: Installation, Setup, and Getting Started

WIRIS quizzes web services Getting started with PHP and Java

CSI 2132 Lab 8. Outline. Web Programming JSP 23/03/2012

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

IBM Rational Web Developer for WebSphere Software Version 6.0

Getting Started with Web Applications

era J2EE Platform and Tool Recommendations

Web-JISIS Reference Manual

Service Oriented Architectures

ServletExec TM 6.0 Installation Guide. for Microsoft Internet Information Server SunONE Web Server Sun Java System Web Server and Apache HTTP Server

A Performance Comparison of Web Development Technologies to Distribute Multimedia across an Intranet

Complete Java Web Development

JEE Web Applications Jeff Zhuk

C/S Basic Concepts. The Gartner Model. Gartner Group Model. GM: distributed presentation. GM: distributed logic. GM: remote presentation

Building Web Services with Apache Axis2

Building and Using Web Services With JDeveloper 11g

Software Architecture

HPC PORTAL DEVELOPMENT PLATFORM

Sample copy. Introduction To WebLogic Server Property of Web 10.3 Age Solutions Inc.

Web Frameworks. web development done right. Course of Web Technologies A.A. 2010/2011 Valerio Maggio, PhD Student Prof.

Course Number: IAC-SOFT-WDAD Web Design and Application Development

Getting Started with Amazon EC2 Management in Eclipse

Japan Communication India Skill Development Center

Web and Enterprise Applications Developer Track

Understanding Application Servers

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

Java Technology in the Design and Implementation of Web Applications

Chapter 4. Architecture. Table of Contents. J2EE Technology Application Servers. Application Models

Transcription:

CS 55.17 Developing Web Applications with Java Technologies

Class Introduction Instructor: David B. Pearson Email: Dpearson@SantaRosa.edu Yahoo! ID: DavidPearson Website: http://www.santarosa.edu/~dpearson/

About David I make my living developing web applications using Java technology. I've been working with Java since 1997. I've been teaching Java since 2002. I am a Sun Certified Java Programmer I have also taught Java Programming, PHP Programming, HTML, Introduction to the Apache Web Server

Goal The purpose of this course is to learn to develop web applications using several Java technologies. The skill and knowledge required to write web applications will be developed.

Objectives Understand the rational of the Java servlet specification. Employ object-oriented design methods. Work within an integrated development environment. Learn MVC design patterns

Prerequisites Previous programming experience with Java HTML

Lecture 3 Hour Lecture in Room 2913 and online via Elluminate 6:30 9:30 PM We'll take breaks

Text Books Core Servlets and JavaServer Pages: Core Technologies, Vol. 1 (2 nd Edition) by Marty Hall More Servlets and JavaServer Pages (1 st Edition) by Marty Hall The Java EE 6 Tutorial The Java EE 5 Tutorial

Class Website http://www.santarosa.edu/~dpearson/2011fall/cs5517/

What is JEE? Java Enterprise Edition Open standards based platform for application: Development Deployment Management

Java Editions Java Technology Enabled Devices Java Technology Enabled Desktop Workgroup Server High-End Server

Tiered Enterprise Applications Single Tier Two Tier Three Tier n-tier

Components of Enterprise Applications Things that make up an enterprise application Presentation logic Business logic Data access logic (and data model) System services The evolution of enterprise application framework reflects How flexibly you want to make changes Where the system services are coming from

Single Tier Typically mainframe-based Dumb terminals are directly connected to the computer Centralized model Presentation, business logic and data access are all in one monolithic application

Single Tier: Pros & Cons Pros: No client side management is required Data consistency is easy to achieve Cons: Functionality (presentation, data model, business logic) is intertwined, difficult for updates and maintenance and code reuse

Two Tier SQL request Database SQL response Fat clients talking to back end database SQL queries sent, raw data returned Presentation, Business logic and Data Model processing logic in the client application

Two-Tier: Pros & Cons Pros: Database product independence Cons: Presentation,data model, business logic are intertwined at the client side, difficult for updates and maintenance Data Model is tightly coupled to every client: if DB Schema changes, all clients break Updates have to be deployed to all clients making system maintenance nightmare DB connection for every client, the difficult to scale Raw data transferred to client for processing causes high network traffic

Three-Tier (RPC based) RPC request SQL request Database RPC response SQL response Thinner client: business & data model separated from presentation Business logic and data access logic reside in middle tier while client handles presentation Middle tier server is required to handle system services Concurrency control, threading, transaction, security, persistence, multiplexing, performance, etc.

Three-Tier (RPC based): Pros & Cons Pros: Business logic can change more flexibly than 2- tier model Most business logic resides in the middletier server Cons: Complexity is introduced in the middle-tier server Client and middle-tier server is more tightly coupled (than the three-tier object based model) Code is not really reusable (compared to object based model)

Three-Tier (Remote Object based) Object request SQL request Database Object response SQL response Business logic and data model captured in object Business logic and database are now described in abstraction (interface language) Object models used: CORBA, RMI, DCOM Interface language in CORBA is IDL Interface language in RMI is Java interface

Three-Tier (Remote Object based): Pros & Cons Pros: More loosely coupled than RPC model Code could be more reusable Cons: Complexity in the middle-tier still needs to be addressed

Three-Tier (Web Server) HTML request HTML response Web Server SQL request SQL response Database Browser handles presentation logic Browser talks to web server via HTTP protocol Business logic and data model are handles by dynamic content generation technologies (CGI, Servlet/JSP, ASP)

Three-Tier (Web Server based): Pros & Cons Pros: Ubiquitous client types Zero client management Support various client devices Cons: Complexity in the middle-tier still needs to be addressed

Trends Moving from single-tier or two-tier to multi-tier architecture Moving from monolithic model to object-based application model Moving from application-based client to HTMLbased client

Single-tier vs. Multi-tier Single-tier Multi-tier No separation among presentation, business logic, database Hard to maintain Separation among presentation, business logic, database More flexible to change, i.e. presentation can change without affecting other tiers

Monolithic vs. Object-based Monolithic 1 binary file Recompiled, relinked, redeployed every time there is a change Object-based Pluggable parts Reusable Enables better design Easier update Implementation can be separated from interface Only interface is published

Outstanding Issues & Solutions Complexity at the middle tier still remains Duplicate system services still needs to be provided for the majority of enterprise applications Concurrency control, transactions Load-balancing, Security Resource management, Connection pooling How to solve this problem? Commonly shared container that handles the above system services Proprietary versus Open-standard base

Proprietary Solution Use component and container model Components capture business logic Container provides system services The contract between components and container is defined in a well-defined but with proprietary manner Problem of proprietary solution: vendor lock-in Example: Tuxedo,.NET

Open and Standard Solution Use component and container model in which container provides system services in a well-defined and as industry standard JEE is that standard that also provides portability of code because it is base on Java technology and standard-based Java programming APIs

Why JEE?

Platform Value to Developers Can use any JEE implementation for development and deployment Use production-quality standard implementation which is free for development/deployment Use high-end commercial JEE products for scalability and fault-tolerance Vast amount of JEE community resources Many JEE related books, articles, tutorials, quality code you can use, best practice guidelines, design patterns, etc. Can use off-the-shelf 3rd-party business components

Platform Value to Vendors Vendors work together on specifications and then compete in implementations In the areas of Scalability, Performance, Reliability, Availability, Management and development tools, and so on. Freedom to innovate while maintaining the portability of applications Do not have create/maintain their own proprietary APIs

Platform Value to Business Customers Application portability Many implementation choices are possible based on various requirements Price (free to high-end), scalability (single CPU to clustered model), reliability, performance, tools, and more Best of breed applications and platforms Large developer pool

Tiered Java Applications The Client Tier The Web Tier The Business Tier The Enterprise Information Systems Tier

The Web Tier Primary focus of this class Technology Servlets JavaServer Pages Expression Lanaguage JavaServer Pages Standard Tag Library JavaBeans Components JavaServer Faces JavaServer Faces Facelets

The Business Tier Provides the functionality to a particular business domain Technologies Enterprise JavaBeans Web services Java Persistence API entities

The Enterprise Information Systems Tier Typically located on a different machine than the Java EE application server Technologies Java Database Connectivity API (JDBC) Java Persistence API Java EE Connector Architecture Java Transaction API (JTA) Java Mail

Java EE Servers A server application that implements the Java EE platform APIs and provides the standard Java EE services. Composed of Containers The Web Container The Application Client Container The EJB Container

JEE Summary JEE is the platform of choice for development and deployment of n-tier, web-based, transactional, component-based enterprise applications JEE is standard-based architecture JEE is all about community JEE evolves according to the needs of the industry

Servlet & JSP (JavaServer Pages)

What is a Servlet? Java object which extends the functionality of a HTTP server Dynamic content generation Better alternative to CGI, NSAPI, ISAPI, etc. Efficient Platform and server independent Session management Java-based

Servlet vs. CGI Request CGI 1 Request CGI 2 Request CGI 3 CGI Based Webserver Child for CGI 1 Child for CGI 2 Child for CGI 3 Request Servlet 1 Servlet Based WebServer Request Servlet 2 Request Servlet 3 JVM Servlet 1 Servlet 2

A Servlet's Job Read explicit data sent by client (form data) Read implicit data sent by client (request headers) Generate the results Send the explicit data back to client (HTML) Send the implicit data to client (status codes and response headers)

HTTP Headers In a request, HTTP sends hidden data from the browser to the web server, and then it sends what the user is transmitting, this hidden data, because the data comes first, it is call HTTP Headers In a response, HTTP sends hidden data from the web server to the browser, before it sends the data that gets displayed in the browser window.

Why build web pages dynamically? The Web page is based on data submitted by the user E.g., results page from search engines and orderconfirmation pages at on-line stores The Web page is derived from data that changes frequently E.g., a weather report or news headlines page The Web page uses information from databases or other server-side sources E.g., an e-commerce site could use a servlet to build a Web page that lists the current price and availability of each item that is for sale.

What is JSP technology? Enables separation of business logic from presentation Presentation is in the form of HTML or XML Business logic is implemented as Java Beans or custom tags Better maintainability, reusability Extensible via custom tags Builds on Servlet technology

The Power of JSP Idea Use regular HTML for most of page Mark dynamic content with special tags <!DOCTYPE html> <html> <head><title>welcome to Our Store</title></head> <body> <h1>welcome to Our Store</h1> <p>welcome, <!-- User name is "New User" for first-time visitors --> <%= coreservlets.utils.getusernamefromcookie(request) %> To access your account settings, click <a href="account-settings.html">here.</a></p> <p>regular HTML for rest of on-line store s Web page</p> </body> </html>

Online Documentation Servlets and JSP Java 6 http://download.oracle.com/javaee/6/api/ http://download.oracle.com/javase/6/docs/api/index.html

Installing Java,Tomcat and Eclipse

Installing Java SE 6 Minimum Java version Tomcat 7 (Servlet 3.0) requires Java 6 Downloading and installation Follow directions at http://download.oracle.com/javase/ Choose JDK not JRE Not with Java EE, with JavaFX, or with NetBeans

Download and Unzip tomcat Start at http://tomcat.apache.org/ Choose download link on left, then ZIP version Tomcat 7 Just unzip the file i.e. resulting in c:\apache-tomcat-7.0.20

Installing Eclipse Eclipse is a free open source IDE for Java, HTML, CSS, JavaScript, PHP, C++, and more. http://www.eclipse.org/downloads/ Choose Eclipse IDE for Java EE Developers Need version 3.6 (Helios) or better for Tomcat 7 Unzip to C:\eclipse

Configure Eclipse Tell Eclipse about Java version Window Preferences Java Installed JREs Press Add, choose Standard VM, navigate to JDK folder (not bin subdirectory) i.e. C:\Program Files\Java\jdk1.7.0 Tell Eclipse about Tomcat Click on Severs tab at bottom. Right-click in window. New Sever Apache Tomcat 7.0 Next navigate to folder Finish Suppress serializable warnings Window Preferences Java Compiler Errors/Warnings

Hello World

Making Web Apps in Eclipse Make empty project File New Project Web Dynamic Web Project For Target runtime choose Apache Tomcat v7.0 Give it a name A01_Lastname_Firstname Accept all other defaults

Adding Code to Eclipse Projects Locations Java Resources: src Servlet code WebContent Web files (HTML, JavaScript, CSS, JSP, images, etc.) WebContent/some-subdirectory Web content in subdirectory WebContent/WEB-INF web.xml Optional with servlets 3.0. required in 2.5 & earlier Will be discussed later

Testing New App Deploy project Select Servers tab at bottom Right-click on Tomcat Choose Add and Remove Choose project Press Add Click Finish Start Server Right-click Tomcat at bottom Restart (use Start if Tomcat not already running) Test URL http://localhost/appname/ in any web browser

Homework Read Install software Create a Hello World web app