Download presentation
Presentation is loading. Please wait.
Published byBonnie Amberly Greene Modified over 8 years ago
1
Introduction to JavaServer Faces and the Woodstock UI Components Presenter Name presenter@address.com
2
2 Agenda ● JavaServer Faces Overview ● Woodstock Components Overview ● Visual JavaServer Faces Development
3
3 JavaServer Faces Overview
4
4 ● Brings Swing-like development to the web ● Designed to be toolable ● Extensible
5
5 ● Component Model ● Backing Bean Model ● Navigation Model ● Request-Response Life Cycle JavaServer Faces Overview
6
6 Component Model ● Presentation is component based ● Component represented using JSP ● Extensible UI model
7
7 Component Model <h:commandButton value="#{MyBean.Submit}" action="#{MyBean.submit}"/>
8
8 Backing Bean Model ● Backing Beans implement controller logic ● “Managed Bean” facility controls Backing Bean life cycle ● Backing Beans have scope: ● Application – Exists for life of web application ● Session – Exists for entire session ● Request – Exists only for a request
9
9 Backing Bean Model ● Backing Beans declared in “faces- config.xml” MyBean myorg.MyBean request
10
10 Backing Bean Model ● Components are bound to Backing Beans via: ● Instances ● Values ● Events are bound to Backing Bean methods
11
11 Backing Bean Model <h:commandButton id="mybutton" value="#{MyBean.buttonText}" action="#{MyBean.myAction}"> Instance Binding Value Binding Method Binding
12
12 Backing Bean Model public class MyBean { private UIOutput output; private String buttonText; public String myAction() {... } Instance Binding Value Binding Method Binding
13
13 Demo #1 JavaServer Faces Components and Backing Beans
14
14 Navigation Model ● Uses navigation rules ● Rules use outcome strings from method bindings for ● Buttons ● Hyperlinks
15
15 Navigation Model... /welcomeJSF.jsp page2 /Page2.jsp
16
16 Navigation Model public String navigateNext() { return "page2"; }
17
17 Demo #2 Navigation
18
18 Request-Response Life Cycle ● Determines how a page is processed ● Three scenarios ● Non-JSF to JSF page ● JSF page to Non-JSF page ● JSF page to JSF page
19
19 Request-Response Life Cycle Life cycle broken down into phases 1. Restore View – Process request 2. Apply Request Values – Update components 3. Process Validations - Validations 4. Update Model Values - Binding 5. Invoke Application - Navigation 6. Render Response – Show page
20
20 Request-Response Life Cycle ● Override default phase behavior ● Phase-Listener ● View-Handler ● Action-Listener ● Specified in “META-INF/faces-config.xml”
21
21 Woodstock UI Components Overview
22
22 Woodstock Overview ● http://woodstock.dev.java.net http://woodstock.dev.java.net ● Current version - 4.1.1 ● Open source project started by Sun Microsystems, Inc. ● Rich set of UI components ● Experienced team of component developers
23
23 Woodstock Overview ● Components used in Visual Web and Sun admin consoles ● Built in AJAX support ● Server support ● Today – JSF ● Future – PHP, Ruby, etc. ● Client-side rendered
24
24 Demo #3 Woodstock components
25
25 Visual JavaServer Faces Development
26
26 Visual JSF Development ● Drag-n-Drop development ● Visual Page design ● Visual binding ● Visual component customization
27
27 Visual JSF Development ● Specialized application model ● JSP page/backing bean- 1:1 mapping ● Simplified life cycle management ● init ● preprocess ● prerender ● destroy
28
28 Visual JSF Development ● Pre-defined scope backing beans ● PageBean – request scope ● RequestBean – request scope ● SessionBean – session scope ● ApplicationBean – application scope
29
29 Visual JSF Development ● Component support ● Standard JSF components ● Woodstock components ● 3 rd party components ● ICEFaces ● Component design-time support
30
30 Demo #4 Visual Web JavaServer Faces
31
31 Conclusion ● JavaServer Faces brings Swing- like development to the web ● Woodstock components offer rich alternative to standard components ● NetBeans Visual Web makes JavaServer Faces development much easier
32
32 Resources ● http://java.sun.com/javaee/javaserverfaces/ http://java.sun.com/javaee/javaserverfaces/ ● https://woodstock.dev.java.net https://woodstock.dev.java.net ● http://visualweb.netbeans.org/ http://visualweb.netbeans.org/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.