java edge.2007.what.is.new.in.jsf.2

84

Upload: roialdaag

Post on 18-May-2015

966 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Java Edge.2007.What.Is.New.In.Jsf.2
Page 2: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 2

What’s new in JSF 2.0 ?

Roi Aldaag

Consultant, AlphaCSP

[email protected]

Page 3: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 3

Objective

Overview of the new requested

features of the upcoming

JSF 2.0

Page 4: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 4

Agenda

IntroductionJSF Evolution

JSF 1.0 / 1.1JSF 1.2

JSF 2.0JSR 314Community wish listTechnology AdoptionEase of developmentFeaturesPerformance

Page 5: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 5

Introduction

Something about acronyms

Definition

Motivation

JSF Ecosystem

Architecture

Page 6: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 6

Something about acronyms…

Not so long ago, if you “Googled“

the word JSF, you probably would

have come across …

Page 7: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 7

Something about acronyms…

The F-35 Joint Strike Fighter (JSF) …

(AKA Lightning II)

Page 8: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 8

Something about acronyms…

Today you’d find…

And probably also …AlphaCSPSpecializes in high availability e-business

application design and ASP hosting

services on the UML, EJB, JAVA, J2EE,

CORBA, XML and WML platforms.

www.alphacsp.com

Sponsored Links

JavaServer Faces Technology

Page 9: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 9

Definition

What is JSF?

Specification

UI framework

Component based

Server side

Java web applications

Page 10: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 10

Motivation

Servlet/JSP API

No GUI structure

No model

No event handling mech.

No I18N support

AWT / Swing

Not web oriented

Many web frameworks

Page 11: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 11

“Welcome to the jungle”

Echo

Cocoon Millstone OXF

Struts SOFIA Tapestry

WebWork RIFE Spring MVC

Canyamo Maverick JPublish

JATO Folium Jucas

Verge Niggle

Bishop

Barracuda Action Framework Shocks

JSFTeaServlet wingS

Expresso Bento jStatemachine

jZonic OpenEmcee Turbine

Scope Warfare JWAA

Jaffa Jacquard

Macaw

Smile MyFaces Chiba

JBanana Jeenius JWarp …

Java Web Frameworks (partial list)

Page 12: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 12

Motivation

How do we choose?

We need a standard !

Vendor adoption

IDE integration

Support

JSF is a standard

Page 14: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 14

Architecture

Front Servlet(FacesServlet)

Controller

Event Listeners &

Action Handlers(ValueChangeListener,

ActionListener)

Config(faces-config.xml)

Events(ValueChangeEvent,

ActionEvent)

ModelView

Component

Model(Java Beans)

Delegates(Convertors,

Validators,

Renderers)

Resources(JSP,

XML,

Properties)

Component

Tree(UIComponent)

Business

Objects(Managed Beans)

Request

Response

UIViewRoot

UIForm

UIInput UIInput

UIPanel

• Model

• View

• Controller

Page 15: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 15

Architecture

Front Servlet(FacesServlet)

Controller

Event Listeners &

Action Handlers(ValueChangeListener,

ActionListener)

Config(faces-config.xml)

Events(ValueChangeEvent,

ActionEvent)

ModelView

Component

Model(Java Beans)

Delegates(Convertors,

Validators,

Renderers)

Resources(JSP,

XML,

Properties)

Component

Tree(UIComponent)

Business

Objects(Managed Beans)

Request

Response

UIViewRoot

UIForm

UIInput UIInput

UIPanel

• Controller

• Front Servlet

• Configuration

• Event Listeners

Page 16: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 16

Architecture

Front Servlet(FacesServlet)

Controller

Event Listeners &

Action Handlers(ValueChangeListener,

ActionListener)

Config(faces-config.xml)

Events(ValueChangeEvent,

ActionEvent)

ModelView

Component

Model(Java Beans)

Delegates(Convertors,

Validators,

Renderers)

Resources(JSP,

XML,

Properties)

Component

Tree(UIComponent)

Business

Objects(Managed Beans)

Request

Response

UIViewRoot

UIForm

UIInput UIInput

UIPanel

• Model

• Business Objects

• POJO’s

Page 17: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 17

Architecture

Front Servlet(FacesServlet)

Controller

Event Listeners &

Action Handlers(ValueChangeListener,

ActionListener)

Config(faces-config.xml)

Events(ValueChangeEvent,

ActionEvent)

ModelView

Component

Model(Java Beans)

Delegates(Convertors,

Validators,

Renderers)

Resources(JSP,

XML,

Properties)

Component

Tree(UIComponent)

Business

Objects(Managed Beans)

Request

Response

UIViewRoot

UIForm

UIInput UIInput

UIPanel

• View

• Component Tree

• Component Model

• Delegates

• Resources

Page 18: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 18

Architecture

Lifecycle

Restore view

Apply request values

Process validations

Update model values

Invoke application

Render response

Page 19: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 19

Architecture

Example

JSP with JSF tags

Component Tree

Markup

UIViewRoot

UIForm

UIInput UIInput

UIPanel

...

<f:fiew>

<h:form>

<h:panelGrid columns = "2">

<h:inputText/>

<h:inputSecret/>

</panelGrid>

</h:form>

</f:view>

..

HTML

JSP

WML

XML

Page 20: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 20

JSF Evolution

Page 21: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 21

JSF Evolution

History

JSF 1.0 / 1.1

JSF 2

Page 22: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 22

History

2004 2006 2008 ??

JSF 1.0, 1.1

JSR 127

Servlet 2.3, JSP 1.2

JSF 1.2

JSR 252

Servlet 2.5, JSP 2.1

JSF 2.0

JSR 314

JSR Review Ballot:May 2001Final Release 2:May 2004

JSR Review Ballot:August 2004Final Release 2:May 2006

JSR Review Ballot:May 2007Final Release 2:JEE6 – 4Q 2008

Page 23: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 23

JSF 1.1 (JSR 127)‏

Shortcomings

JSF – JSP Mismatch

<h:commandLink action="foo">

Read between the lines

</h:commandLink>

Read between the lines

<a href=“#” onClick=“…”></a>

<h:commandLink action="foo">

<h:outputText

value="Read between the lines”/>

</h:commandLink>

<a href=“#” onClick=“…”>

Read between the lines

</a>

Page 24: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 24

JSF 1.1 (JSR 127)‏

Shortcomings

JSF – JSP Mismatch

Different Lifecycle

Writing to the same stream

Limited EL

Not compatible with JSP EL

Forbidden nesting components (<c:forEach>)‏

Page 25: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 25

JSF 1.2 (JSR 252)‏

Improvements New Content Interweaving Model

JSP ViewHandler, JSP Base Tag class

Unified EL in JSTL (javax.el)

Deferred evaluation

Support get / set value

Support method invocation

Pluggable API for resolving expressions

JSTL integration (<c:forEach>)‏

Back Button / Multi Frame Apps

Message association

JSP EL JSF EL

Unified EL

Page 26: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 26

JSF 1.2 (JSR 252)‏

Shortcomings Development

Customizing components is complicatedExceptions are not descriptiveNo support for annotations

DeploymentUnnecessary deployment stepNot JEE compliant (packaging, DI)‏

ComponentsMissing / Limited components

SecurityNo security model (managed beans, resources)‏

Ajax

Page 27: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 27

Custom Components

Let’s say we want a collapsible panel …

Page 28: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 28

Custom Components: JSF 1.2

UICollapse.java CollapseTag.java

collapse.tld

faces-config.xml

UIComponentBase.java UIComponentTag.java extend

write

modify

Page 29: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 29

Custom Components: JSF 1.2

UICollapse.java

Page 30: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 30

Custom Components: JSF 1.2

CollapseTag.java

Page 31: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 31

Custom Components: JSF 1.2

collapse.tld

Page 32: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 32

Custom Components: JSF 1.2

faces-config.xml

Page 33: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 33

Custom Components: JSF 1.2

Too much wiring !!!

Page 34: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 34

Custom Components: Facelets

collapse.xhtml

Page 35: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 35

Exceptions: JSF 1.2

No centralized exception handling

Servlet filter

Poor documentation

“Silent error”

Validation error

No Exception

No log output

Need to use <h:messages/>

Unified EL wraps exception

Page 36: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 36

Exceptions: JSF 1.2

exception.jsf

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

<f:view>

<h:form>

<h:inputText value="#{myBean.name}"/>

</h:form>

</f:view>

public class MyBean {

public String getName() {

if(true) throw new RuntimeException("my exception");

return "line not reached";

}

. . .

}

MyBean.class

Page 37: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 37

Exceptions: JSF 1.2

Instead ofA stack trace dump

javax.servlet.ServletException: javax/servlet/jsp/tagext/JspIdConsumer

Page 38: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 38

Exceptions: Facelets

We should be gettingVerbose description (location, tree, phase, variables)‏

javax.el.ELException: /exception.xhtml @7,40 value="#{myBean.name}": java.lang.RuntimeException

Page 39: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 39

Ajax: JSF 1.2

• Good:

– Ajax “ready”

– JSF component maintain state

– Well defined req processing

– Hides JS from page author

• Bad:

– No built-in support

– No standard

– Full view rendering

– Incompatible comp. libraries

Page 40: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 40

Templating: JSF 1.2

• No standard support

– <f:subview../>

– <c:import…/>

– <jsp:include …/>Header

Footer

Nav Content

Page 41: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 41

Community Reservations

“… It is OK to learn things,

but learning should be like

series of "AHA!" moments

and "WOW! they do that too!"

exclamations.

Learning JSF is series

of WTF moments -

and it should not be! …”

“JSF Articles – Wish List for JSF 2.0 and more AJAX+JSF”,

The Server Side, April 05, 2007

Page 42: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 42

Community Reservations

“… I download 1 framework and it should be complete.

Don't tell me I need to download 5 other packages from various websites to make it actually useful??? …”

“… JSF should not be like a mine-field. It should be fun to use. It should be impossible for a silent error to occur, and

this is exactly what happens when you have a validation error but no corresponding h:message(s) tag. …”

News / Comments -“JSF sucks...and has no hope”

The Server Side, 2007

Page 43: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 43

Community Wish List

Facelets integration

Client Side Validation

Scoping

Easier Development of components

Simplify configuration

Centralized Exception handling

Navigation Rules API

Hard failure

Page 44: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 44

The Irony

JSF defined a standard

UI development has advanced

JSF got “old”

Many great ideas

Many JSF extensions (to fill void)‏

New technologies

Irony: Back to starting point

Need for a new standard

Page 45: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 45

JSF 2.0

JSR 314

Ease of development

Technology Adoption

Features

Performance

Page 46: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 46

JSR 314

Purpose

Max. development productivity (IDE)‏

Min. maintenance complexity

Integrate with other web tech.

More responsive UI (Ajax)‏

Requirements

Ease of development

New Features & Fixes

Performance & Scalability

Technology Adoption

Page 47: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 47

JSR 314

Specification LeadEd Burns Sun Microsystems, Inc.Roger Kitain Sun Microsystems, Inc.

Page 48: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 48

JSR 314

Milestones (anticipated):

JavaEE6Proposed Final Draft

Apr 08Mar 08Public Review Ballot

Mar 08Feb 08Public Review

Oct 07Oct 07Early Draft Review

Aug 07May 07EG Formation

May 07Apr 07JSR Review Ballot

Apr 07Apr 07File JSR with JCP

16 Mar 079 Mar 071st EG Public Draft Review

9 Mar 077 Mar 07Author 1st EG Public Draft

9 Mar 0715 Feb 072nd Draft Reviewed

9 Feb 077 Feb 07Author 1st Draft

Stage Start Finish

Page 49: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 49

JSR 314

Introducing the Experts

Page 50: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 50

Let the experts play

Expert Group Kick-off Meeting

Buy a Feature

Will the community needs be met?

Page 51: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 51

Let the experts play (cont.)

Feature List (partial):

50New listeners for lifecycle eventsListeners

80Better error reportingErrors

80Expand lifecycle to be aware of Ajax, client lifecycle

Ajax

100Simplify creation of customize components

EZComp

100Eliminate Deployment StepZero Dep

165Templating, Component AggregationFacelets

Name Feature Cost

Page 52: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 52

Let the experts play (cont.)

Feature List (cont.):

60Skinning / ThemeingSkins

80Default to stateless componentsFix State

25Declarative rendering (no out.println)‏Rendering

25Components, managed beans, navigation rules

Annotations

80Bookmarking, support got “GET”Mostly Get

50No faces-confix.xml, no web.xmlConfig.

Name Feature Cost

Page 53: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 53

Let the experts play (cont.)

The Results:

3

3

4

4

4

4

5

Number of units purchased

80Errors

100EZComp

15Validation++

80State Saving

25Annotations

165Facelets

80Ajax

Name Cost

Page 54: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 54

JSF 2.0

JSR 314

Ease of development

Technology Adoption

Features

Performance

Page 55: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 55

Ease Of Development

Annotations

Templating

Component Aggregation

Verbose Exceptions

JSF Artifacts in WAR

Page 56: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 56

Ease Of Development

Annotations

Page 57: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 57

Ease Of Development

Annotations: JSF 1.2

• Tedious XML

– faces-config.xml

– Web.xml

• JEE 5 Annotations

– @EJB

– @PersistenceContext

– …

Page 58: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 58

Ease Of Development

Annotations: JSF 2.0

• Artifacts

– Managed beans

– Scope

– Navigation Rules

– Dependency Injection

– Converters

– Validators

• Zero Configuration

• Skip deployment

@Property(el=true, saveState=true)‏

@Bean

@PhaseListener

@Converter

Page 59: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 59

Ease Of Development

Templating

• Faceletes

– Develop UI live

• JSF Templating

– Pages, components

• Struts Tiles

– Layouts

– Screen definition

– Inheritance

Header

Footer

Nav Content

Page 60: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 60

JSF 2.0

JSR 314

Ease of development

Technology Adoption

Features

Performance

Page 61: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 61

Technology Adoption

Ajax

Passing values between pages

Skinning / Themeing

Web Beans JSR 299

Client lifecycle / validation

Server Side Scripting

Page 62: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 62

Technology Adoption

Ajax: Page wide

• Page wide support (region, zone)‏

• Add support to existing components

• Sub view processing

• Partial tree rendering

• Normal lifecycle

• Partial page refresh

• Example: Ajax4Jsf, Dynamic Faces

Page 63: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 63

Technology Adoption

Ajax: Component wide

• Ajaxified components

– Minimal Ajax awareness required

• Example:– RichFaces, IceFaces, ADF (Trinidad)‏

RCFaces, Galileo Faces, Woodstock

• Client validations

• Client component interaction

Page 64: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 64

Technology Adoption

Ajax example:

Page 65: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 65

<f:view>

<h:outputText value="Ajax List Demo"/>

<h:form>

<h:panelGrid columns="2">

<h:panelGrid>

<h:outputText value="Country:"/>

<a4j:region>

<h:selectOneListbox id="countryId">

<f:selectItems value="#{myBean.countries}" />

<a4j:support event="onchange" reRender="cityId"

action="#{myBean.changeCountry}" ajaxSingle="true"/>

</h:selectOneListbox>

</a4j:region>

</h:panelGrid>

<h:panelGrid>

<h:outputText value="City:"/>

<h:selectOneListbox id="cityId">

<f:selectItems value="#{myBean.cities}" />

</h:selectOneListbox>

</h:panelGrid>

</h:panelGrid>

<h:commandButton value="Submit" action="none" />

</h:form>

</f:view>

<a4j:region>

<h:selectOneListbox id="countryId">

<f:selectItems value="#{myBean.countries}" />

<a4j:support event="onchange" reRender="cityId"

action="#{myBean.changeCountry}" ajaxSingle="true"/>

</h:selectOneListbox>

</a4j:region>

Technology Adoption

Ajax4Jsf example:

Page 66: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 66

Technology Adoption

UIOutput UISelectOne

UIPanel

UIForm

UIOutput UISelectOne

UIPanel

UIPanel

AjaxViewRoot

UIOutput

UICommand

Partial Tree DecodePartial Page Submit

Page 67: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 67

Technology Adoption

UIOutput UISelectOne

UIPanel

UIForm

UIOutput UISelectOne

UIPanel

UIPanel

AjaxViewRoot

UIOutput

UICommand

Partial Tree RenderPartial Page Refresh

Page 68: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 68

Technology Adoption

Passing values between pages: JSF 1.2

Supported scopes

Page, Session, Application

State

Client: Cookie, URL encoding, hidden field

Server: HttpSession, ServletContext

Page 69: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 69

Technology Adoption

Passing values between pages

Dialog / Conversation / Process scope

Example:

JBoss Seam

Apache Shale

Spring WebFlow

Oracle ADF

Page 70: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 70

Technology Adoption

Skinning /

Themeing

Page 71: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 71

Technology Adoption

Skinning / Themeing

• Changing component style

– Dynamically

– Instantly

• Technologies

– Oracle ADF Faces

– Apache Trinidad

– JBoss Rich Faces

– Icesoft IceFaces

Page 72: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 72

Technology Adoption

Skinning / Themeing

• Example:

Page 73: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 73

JSF 2.0

JSR 314

Ease of development

Technology Adoption

New Features

Performance

Page 74: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 74

New Features

Separate build / render tree

Bookmarking

Additional standard components

AJAX aware lifecycle

Partial tree traversal

Page actions

Access to persistence store

Page 75: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 75

New Features

Separate build / render tree

Initial Request

Render Response Phase

Create Component Tree

Render Tree

Postback Request

Restore View Phase

Create Component Tree

Render Response Phase

Render Tree

Page 76: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 76

New Features

Bookmarking

JSF 1.2

No support in <h:form/>

Command component don’t generate GET

Use implicit “param”

Enhanced Support for Http GET

New lifecycle for non-faces request (init req)‏

Submitted values come from HTTP paramsnot (input components)‏

Page 77: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 77

New Features

Additional standard componentsCurrent set is to weak

Components from different vendors cannot coexist

Date Picker File Upload Tree

Tabbed Panel

Page 78: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 78

JSF 2.0

JSR 314

Ease of development

Technology Adoption

Features

Performance

Page 79: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 79

Performance

Save / restore page deltas

ADF

Client side component validations

Inter client component interaction

Example: Dual combo box

Caching for rendering

Improve PhaseListener Interceptor

Filter requests

Page 80: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 80

Prolog

The question should be:

Not - will the community needs be met ?

But, will the community needs be met -

on time … ?

Page 81: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 81

Q&A

Page 82: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 82

Definition

What is JSF ?

A server side user interface component framework for Java technology based web applications.

Sun J2EE 1.4 Tutorial

A component-based, Web-tier UI framework

Mastering JavaServer Faces, Wiley 2004

A component architectureA standard set of UI widgetsAn application infrastructure

JavaServer Faces in Action, Manning 2005

A specification with implementations offered by multiple vendorsA set of user interface (UI) componentsAPI for extending the standard components or developing new

JavaServer‏Faces,‏O’Reilly2004‏

A set of prefabricated UI (user interface) componentsAn event-driven programming modelA component model that enables third-party developers to supply additional components

Core JavaServer Faces, Sun 2007

Page 83: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 83

Resources

JSR Drafthttps://javaserverfaces-spec-public.dev.java.net/

proposals/JSF-2_0-draft.html

JCP – JSR 314http://jcp.org/en/jsr/detail?id=314

Ed Burns Bloghttp://weblogs.java.net/blog/edburns

“The Requirements Scratchpad”http://wiki.java.net/bin/view/Projects/Jsf2RequirementsScratchpad

Community Forums & Blogs

Page 84: Java Edge.2007.What.Is.New.In.Jsf.2

Copyright AlphaCSP Israel 2007 - The JavaEdge SeminarCopyright AlphaCSP Israel 2007 - The JavaEdge Seminar 84

Wish List

Pre-JCP-filed draft for JavaServer Faces 2.0 JSR / Ed Burns

http://weblogs.java.net/blog/edburns

JSF 2.0 requirements scratchpadhttp://wiki.java.net

JSF 2.0 is Here!http://www.oreillynet.com/onjava

JSF 2.0 Wish List Part 1 / Kito Man

http://www.jsfcentral.com

EE6 wishlist part II: JSF / Gavin King

http://in.relation.to

JSF 2.0 Begins