600 likes | 758 Views
Java Server Faces adopting the standard. Roi Aldaag Consultant, AlphaCSP. Agenda. Introduction Architecture Configuration Features Pros & Cons. Introduction. Not so long ago, if you “Googled“ the word JSF , you probably would have come across …. Introduction.
E N D
Java Server Facesadopting the standard Roi Aldaag Consultant, AlphaCSP
Agenda • Introduction • Architecture • Configuration • Features • Pros & Cons
Introduction • Not so long ago, if you “Googled“ • the word JSF, you probably would • have come across …
Introduction The F-35 Joint Strike Fighter (JSF) …
Introduction JavaServer Faces Technology Today you’d find…
Introduction :: What is JSF? • What is JSF ? • Specification • UI framework • Component based • Server side • Java web applications
Introduction :: Motivation 9 Billion Reasons for JSF…
Introduction :: Motivation • JCP Standard JSF 1.0/1.1JSR 127 May 2005 JSF 1.2JSR 252 May 2006 JSF 2.0 JSR 314 Q4 2008 ? / JEE6
Introduction :: Motivation • Vendor adoption • JSF RI • MyFaces
Introduction :: Motivation • Popularity • Commercial Projects • Open Source Projects • Market • Documentation
Introduction :: Motivation • IDE integration • Visual tool support • Drag & Drop • Auto-complete
Introduction :: Motivation • Tools • Component Libraries • IceFaces • RichFaces • ADF / Trinidad • Tomahawk • Extensions • Facelets • Ajax4Jsf • DinoFaces
Introduction :: Motivation • View Technology • JSP / Servlet • Other template engines • Facelets • JSFTemplating • Multiple rendering output from same pages
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
Introduction :: What is Seam? • Misconceptions • Can be used without EJB3 • Does not need a container • Has a small footprint • Easy integration
Introduction :: Why JSF+Seam? • Why JSF + Seam? • JSF has some weaknesses… • Seam extends and enhances JSF • Reduces boilerplate code • Annotations • RESTful URLs • JSF Lifecycle • Contextual state management • Ajax Remoting • Exception Handling • Simple Integration • EJB3 / jBMP/ Drools / Spring
Agenda • Introduction • Architecture • Configuration • Features • Pros & Cons
Architecture :: JSF MVC • Model • View • Controller
Architecture :: JSF MVC Model • POJO’s
Architecture :: JSF MVC Controller • Front Servlet • Configuration • Event Listeners
Architecture :: JSF MVC View • Component Tree • Component Model • Delegates • Resources
Architecture :: Component Tree JSF tags Component Tree Markup ... <f:view> <h:form> <h:panelGrid columns = "2"> <h:inputText/> <h:inputSecret/> </panelGrid> </h:form> </f:view> .. HTML WML XML JSP
Architecture :: JSF Lifecycle • JSF Lifecycle • Restore view • Apply request values • Process validations • Update model values • Invoke application • Render response
Architecture :: Seam Lifecycle • Seam Lifecycle • Restore view • Restore Conversation • Apply Page Parameters • Apply request values • Process validations • Update model values • Invoke application • Process Selection • Store Conversation • Render response
Architecture :: Seam Concepts • Seam Concepts • Three Tier • POJOs and annotations • IoC and bijection • Contextual state management • Interceptors
Agenda • Introduction • Architecture • Configuration • Features • Pros & Cons
Configuration :: JSF faces-config.xml
Configuration :: Seam faces-config.xml
Configuration :: JSF web.xml
Configuration :: Seam web.xml
Agenda • Introduction • Architecture • Configuration • Features • Pros & Cons
Features :: Demo JSF Project jsfLogin.jsp jsfMasterDetail.jsp LoginBean.java MasterDetailBean.java XML JSP XML JSP faces-config.xml web.xml
Features :: Demo Seam Project jsfLogin.jsp jsfMasterDetail.jsp LoginBean.java MasterDetailBean.java XML XML JSP seam.properties components.xml JSP faces-config.xml web.xml jboss-seam.jar jboss-seam-ui.jar
Features :: Demo Login page jsfLogin.jsp UIViewRoot UIForm UIPanel UIPanel UIPanel UIOutput UICommand UIInput UIOutput UIInput
Features :: JSF Value Binding LoginBean.java faces-config.xml Managed Bean jsfLogin.jsp Unified EL
Features :: JSF Method Binding LoginBean.java jsfLogin.jsp Invoke Application Phase
Features :: JSF State Management jsfLogin.jsp jsfMasterDetail.jsp User Dependency Injection
Features :: Seam State Management • Contextual state management • Bijection • @In - Injection • @Out – Outjection • Dynamic, contextual, bidirectional • Context Scope • Event < Page < Conversation < Business Process < Session < Application • Conversation • Temporary conversation • Long-running conversation • ConversationId
Features :: Seam State Management MasterDetailBean.java
Features :: JSF Page Flow LoginBean.java jsfLogin.jsp jsfMasterDetail.jsp faces-config.xml
Features :: Seam Page Flow HTTP GET • Page Actions • HTTP GET • Bookmarking • RESTful URLs HTTP POST
Features :: Seam Page Flow • Page Flow • JBoss Business Process Management (jBPM) • Used to define process workflow / page flow • Define transition between pages • Define navigation rules for each page • Flow is based on events and conditions • Back button • In conversation mode, back button is disallowed • Undefined transition • Seam blocks actions from “stale” pages • Redirects to relevant page
Features :: JSF Validations MasterDetailBean.java jsfMasterDetail.jsp
Features :: Seam Validations @org.hibernate.validator.Email MasterDetailBean.java jsfMasterDetail.jsp
Features :: JSF Error Handling javax.servlet.ServletException: javax/servlet/jsp/tagext/JspIdConsumer
Features :: Seam Error Handling • Exception Annotations
Features :: Demo MasterDetail page jsfMasterDetail.jsp MasterDetailBean.java