Architecting JSF Based Web Applications for the Real World...

Preview:

Citation preview

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 1

Building JSF ApplicationsArchitecting JSF Based Web Applications for the Real World

Bill DudneyObject Systems Groupbdudney@mac.com

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 2

AgendaJSF Overview

Patterns & Architecture of JSFJSF Request/Response LifecycleComponents

Separation of ConcernsJSF User InterfaceServicesConnecting

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 3

What Is JSF?Standard Web Application Framework

Defines the Programming ModelReusable ComponentsBuilds HTML from ComponentsValidation & ConversionComponent Tree

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 4

Goals of JSFEase/Simplify DevelopmentSupport from/by toolsEvents easily tied to server side codeEase of extensionManage UI state

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 5

AgendaJSF Overview

Patterns & Architecture of JSFJSF Request/Response LifecycleComponents

Separation of ConcernsJSF User InterfaceServicesConnecting

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 6

Patterns & Architecture of JSFModel-View-ControllerComposite Component TreeServer Side Events

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 7

Standard MVCMajor Benefits

Separation of ConcernsLoose coupling

Won’t work on the webBrowsers don’t listen to server eventsWhat objects would observe models?

So what to do to get the benifits?

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 8

Enter JSF Web MVC

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 9

JSF Provides Web MVCController

FacesServletLifeCycleApplicationNavaigationHandlerActionListenerConversion and Validation

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 10

JSF Provides Web MVCView

RenderKitRenderers

ModelJavaBeansEJB’s

Extension PointsView & Controller are extensible

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 11

Typical Implementation

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 12

Composite Component TreeClient view is simple

Whole tree looks like one

ImplementationSimplified

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 13

Server Side EventsEvents are cued & consumed server side

Typically from user actions (button clicks, etc.)

Possible to add programatically

Observer Pattern

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 14

AgendaJSF Overview

Patterns & Architecture of JSFJSF Request/Response LifecycleComponents

Separation of ConcernsJSF User InterfaceServicesConnecting

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 15

JSF Request/Response LifecycleRestore ViewApply Request ValuesProcess ValidationsUpdate Model ValuesInvoke ApplicationRender Response

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 16

AgendaJSF Overview

Patterns & Architecture of JSFJSF Request/Response LifecycleComponents

Separation of ConcernsJSF User InterfaceServicesConnecting

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 17

UIComponentHub of the frameworkTypically Delegate

RenderingValidatingConverting

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 18

AgendaJSF Overview

Patterns & Architecture of JSFJSF Request/Response LifecycleComponents

Separation of ConcernsJSF User InterfaceServicesConnecting

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 19

Running Example

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 20

UIComponent Instances

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 21

Implementation

Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, Object Systems Group

Bill Dudney — Building JSF Applications Page 22

To the Code!