Escolar Documentos
Profissional Documentos
Cultura Documentos
Roi Aldaag
Consultant, AlphaCSP
2
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Agenda
Introduction
Architecture
Configuration
Features
Pros & Cons
3
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction
4
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction
5
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction
6
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction :: What is JSF?
What is JSF ?
Specification
UI framework
Component based
Server side
Java web applications
7
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction :: Motivation
8
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction :: Motivation
JCP Standard
9
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction :: Motivation
Vendor adoption
JSF RI
MyFaces
10
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction :: Motivation
Popularity
Commercial Projects
Open Source Projects
Market
Documentation
11
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction :: Motivation
IDE integration
Visual tool support
Drag & Drop
Auto-complete
12
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction :: Motivation
Tools
Component Libraries
IceFaces
RichFaces
ADF / Trinidad
Tomahawk
Extensions
Facelets
Ajax4Jsf
DinoFaces
13
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction :: Motivation
View Technology
JSP / Servlet
Other template engines
Facelets
JSFTemplating
Multiple rendering output
from same pages
14
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction :: What is Seam?
What is Seam ?
A lightweight framework for JEE5
Unifies JSF and EJB models
(Web Beans / JSR 299)
Integrates JSF, POJOs, JPA, jBMP, Drools
Annotation / EL based
Extends JSF
JBoss OS (LGPL)
Release at 2006
Current version 2.0.2 SP1
15
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction :: What is Seam?
Misconceptions
Can be used without EJB3
Does not need a container
Has a small footprint
Easy integration
16
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction :: Why JSF+Seam?
17
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Introduction :: Seam in action
18
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Agenda
Introduction
Architecture
Configuration
Features
Pros & Cons
19
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Architecture :: JSF MVC
Controller
Model Config
(faces-config.xml)
Controller
(FacesServlet) (ValueChangeListener,
ActionListener)
Component
Tree Component Business
(UIComponent) Model Objects
(Java Beans) (Managed Beans)
UIViewRoot
Delegates
UIForm (Convertors,
Validators,
Renderers)
Response UIPanel
UIInput UIInput
Resources
(JSP,
XML,
Properties)
View Model
20
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Architecture :: JSF MVC
Controller
Model
Config
(faces-config.xml)
POJO’s
Request Events
(ValueChangeEvent,
ActionEvent)
Event Listeners &
Front Servlet Action Handlers
(FacesServlet) (ValueChangeListener,
ActionListener)
Component
Tree Component Business
(UIComponent) Model Objects
(Java Beans) (Managed Beans)
UIViewRoot
Delegates
UIForm (Convertors,
Validators,
Renderers)
Response UIPanel
UIInput UIInput
Resources
(JSP,
XML,
Properties)
View Model
21
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Architecture :: JSF MVC
Controller
Controller
Config
(faces-config.xml)
Front Servlet
Request Events
(ValueChangeEvent,
ActionEvent)
Event Listeners &
Event Listeners
Component
Tree Component Business
(UIComponent) Model Objects
(Java Beans) (Managed Beans)
UIViewRoot
Delegates
UIForm (Convertors,
Validators,
Renderers)
Response UIPanel
UIInput UIInput
Resources
(JSP,
XML,
Properties)
View Model
22
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Architecture :: JSF MVC
Controller
View
Config
(faces-config.xml)
Component Tree
Request Events
(ValueChangeEvent,
ActionEvent)
Event Listeners &
Delegates
Resources Component
Tree
(UIComponent)
Component
Model
Business
Objects
(Java Beans) (Managed Beans)
UIViewRoot
Delegates
UIForm (Convertors,
Validators,
Renderers)
Response UIPanel
UIInput UIInput
Resources
(JSP,
XML,
Properties)
View Model
23
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Architecture :: Component Tree
...
UIViewRoot
>f:view< HTML
>h:form<
>"h:panelGrid columns = "2< UIForm
>/h:inputText<
>/h:inputSecret< WML
>panelGrid/<
UIPanel
>h:form/<
>f:view/<
JSP XML
.. UIInput UIInput
24
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Architecture :: JSF Lifecycle
2. Restore view
3. Apply request values Apply Request
Values
4. Process validations
5. Update model values Process Validation
6. Invoke application
Update Model
7. Render response Values
Invoke Appilcation
Render Response
Response
25
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Architecture :: Seam Lifecycle
6. Process validations
Update Model
7. Update model values Values
Process Data Model
8. Invoke application Selection
Invoke Appilcation
9. Process Selection Invoke Page Action
26
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Architecture :: Seam Concepts
Seam Concepts
2. Three Tier
3. POJOs and annotations
4. IoC and bijection
5. Contextual state management
6. Interceptors
27
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Agenda
Introduction
Architecture
Configuration
Features
Pros & Cons
28
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Configuration :: JSF
faces-config.xml
29
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Configuration :: Seam
faces-config.xml
30
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Configuration :: JSF
web.xml
31
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Configuration :: Seam
web.xml
32
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Agenda
Introduction
Architecture
Configuration
Features
Pros & Cons
33
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Demo JSF Project
jsfLogin.jsp jsfMasterDetail.jsp
/webproj
src
managed
WebRoot
WEB-INF
LoginBean.java MasterDetailBean.java
XML
JSP
XML
JSP
web.xml faces-config.xml
34
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Demo Seam Project
jsfLogin.jsp jsfMasterDetail.jsp
/webproj
src
managed
WebRoot
XML
classes
JSP
seam.properties lib
components.xml JSP
jboss-seam-ui.jar
35
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Demo Login page
jsfLogin.jsp
UIViewRoot
UIForm
UIPanel
UIPanel UIPanel
UIOutput UICommand
UIInput
UIOutput
UIInput
36
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: JSF Value Binding
LoginBean.java faces-config.xml
Managed Bean
jsfLogin.jsp
Unified EL
37
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: JSF Method Binding
LoginBean.java jsfLogin.jsp
Invoke Application
Phase
38
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: JSF State Management
jsfLogin.jsp jsfMasterDetail.jsp
User
Dependency Injection
39
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Seam State Management
40
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Seam State Management
MasterDetailBean.java
41
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: JSF Page Flow
LoginBean.java
jsfLogin.jsp jsfMasterDetail.jsp
faces-config.xml
42
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Seam Page Flow
Page Actions
HTTP GET
Bookmarking
RESTful URLs
HTTP POST
HTTP GET
43
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Seam Page Flow
<<Start State>>
<<Decision>>
User
Back button
end
44
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: JSF Validations
MasterDetailBean.java
jsfMasterDetail.jsp
45
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Seam Validations
MasterDetailBean.java
jsfMasterDetail.jsp
org.hibernate.validator.Email@
46
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: JSF Error Handling
javax.servlet.ServletException:
javax/servlet/jsp/tagext/JspIdConsumer
47
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Seam Error Handling
48
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Seam Error Handling
Exception Annotations
49
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Demo MasterDetail page
jsfMasterDetail.jsp
MasterDetailBean.java
50
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Demo MasterDetail page
jsfMasterDetail.jsp - continued
HtmlDataTable
HtmlColumn HtmlColumn
HtmlOutputText HtmlOutputText
51
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: JSF Ajax
52
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: JSF Ajax
53
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Seam Ajax
Ajax Remoting
Similar to DWR
Access seam components from JS
JavaScript APIs
Seam.Component
Seam.Remote
Expose server side components
@WebRemote
Compatible with Ajax4Jsf
Dojo / GWT integration
54
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Features :: Documentation
JSF
Specification
Forums
Books
Seam
Reference
Forums
Books
55
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Agenda
Introduction
Architecture
Configuration
Features
Pros & Cons
56
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Pros & Cons
57
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Pros & Cons
JSF Shortcomings
Too much wiring
HTTP GET / REST is hard
Complicated Lifecycle
Slow learning curve
Writing new components
Poor exception handling
58
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
References
JSF
http://www.jcp.org/en/jsr/detail?id=252
http://jcp.org/en/jsr/detail?id=314
http://myfaces.apache.org/
Seam
http://www.jboss.com/products/seam
http://www.seamframework.org/
59
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar
Thank
You !
60
Copyright AlphaCSP Israel 2008 – Web Framework Playoff Seminar