Java Web Programming - University of Wisconsin–Madisonpages.cs.wisc.edu › ~estan › cs638 ›...

Post on 28-Jun-2020

5 views 0 download

transcript

Introduction toJava Web

Programming

Gregg Sporargregg.sporar@sun.com

2

Agenda

●What is Java?

●Web/Application Servers

●Servlets

●JSPs

●Java Web Frameworks

●JavaServer Faces

●Beyond the Java Language

3

What is Java?

● Runs Everywhere

● and Open SourceFREE

4

Java Flavors

OptionalPackages

Java Enterprise

Edition(Java EE)

Java StandardEdition

(Java SE)

JVM

Java Card APIs

CardVM

OptionalPackages

Personal Basis Profile

Personal Profile

Foundation Profile

CDC

MIDP

CLDC

KVM

Java Micro Edition(Java ME)

5

“Hello World” in Java

6

A Specification...

7

Web/Application Servers

Client

Client

Client

Client

Client

ClientTier

Enterprise Information

TierMiddle

Tier

Enterprise Information

Systems (EIS):

RelationalDatabase,

Legacy Applications,

ERP Systems

Enterprise JavaBeans™

Enterprise JavaBeans

Other Services:JNDI, JMS,JavaMail™

Java EEApplication

Server

Web ServerJSP,

Servlets

Firewall

HTML/XML

8

Web/Application Servers●Open Source

● Tomcat

● JBoss

● Geronimo

● GlassFish

●Proprietary● WebSphere

● WebLogic

● OC4J

9

What is a Servlet?

A servlet is a Java programming language class used to extend the capabilities of servers that host applications accessed via a request-response programming model.

10

Servlet Processing

11

“Hello World” Java Servlet

12

Servlet Deployment

13

“Hello World” Revisited...

Not Very Robust....

14

What is a JSP?

JavaServer Page: 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, such as HTML, SVG, WML, and XML;

...and...

JSP elements, which construct dynamic content.

15

“Hello World” with a JSP

16

You Might Be Wondering...Why does the code do so much grunt work?

17

Java Web Frameworks●Struts

●Tapestry

●Wicket

●Stripes

●Spring MVC

●Google Web Toolkit

●JavaServer Faces (JSF)

●etc...

18

What is JavaServer Faces?

JavaServer Faces technology includes:

* A set of APIs for representing UI components and managing their state, handling events and input validation, defining page navigation, and supporting internationalization and accessibility.

* A JavaServer Pages (JSP) custom tag library for expressing a JavaServer Faces interface within a JSP page.

19

“Hello World” with JSF

20

“Hello World” with JSF (cont'd)

21

“Hello World” with JSF (cont'd)

22

“Hello World” with JSF (cont'd)

23

JSF Life cycle

Source: JSF for nonbelievers, by Rick Hightower

24

Beyond the Java Language

DevicesDevelopment

and more...

The Virtual Machine

JavaFX Script

25

Beyond the Java Language (cont'd)

on

26

Resources ●Java: java.sun.com

●JavaPassion: javapassion.com

●Java EE: java.sun.com/javaee

●Servlets: java.sun.com/products/servlet/articles/tutorial/

●JSP: java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro.html

●JSF: www.ibm.com/developerworks/library/j-jsf1/

●Ruby, JRuby, Rails: www.netbeans.org/kb/trails/ruby.html

●NetBeans: netbeans.org