JSF 2.2 Deep Dive Kito D. Mann Principal Consultant.

Slides:



Advertisements
Similar presentations
Apache Struts Technology
Advertisements

MVC in JavaEE 8 Manfred Riem Principal Member of Technical Staff September, 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
JSF 2.2 in Action Kito D. Mann Principal Consultant.
ISE 390 Dynamic Web Development Java EE Web Applications.
Web Applications Development Using Coldbox Platform Eddie Johnston.
Web applications using JavaServer Faces (JSF) A brief introduction 1JavaServer Faces (JSF)
Struts Basics SSE USTC Qing Ding. Agenda What is and Why Struts? Struts architecture – Controller: Focus of this presentation – Model – View Struts tag.
DT228/3 Web Development JSP: Directives and Scripting elements.
Introduction to Java web programming Dr Jim Briggs JWP intro1.
Stateful Web Application Development with Spring Web Flow John Case Senior Consultant Centare Group, Ltd.
UNIT-V The MVC architecture and Struts Framework.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
JavaServer Faces: The Fundamentals Compiled from Sun TechDays workshops (JSF Basics, Web-Tier Codecamp: JavaServer Faces, Java Studio Creator; IBM RAD)
11. Java-Based Web: JSP, JSF. 2 Motto: Rule 1: Our client is always right Rule 2: If you think our client is wrong, see Rule 1. - Anonymous.
MVC 1.0 Manfred Riem Oracle Geertjan Wielenga Oracle Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Java Server Faces Çağatay Çivici Apache MyFaces Team Member
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Pittsburgh Java User Group– Dec Java PureFaces: A JSF Framework Extension.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
May 16 – 18, 2007 Copyright 2007, Data Access Worldwide May 16 – 18, 2007 Copyright 2007, Data Access Worldwide Build Great Web Application 'Fast and Easy'
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
AJAX Without the “J” George Lawniczak. What is Ajax?
iphone / Mobile Application Development using Oracle ADF Jon Gooding – Solutions Architect.
JDeveloper 10g and JavaServer Faces: High-Performance UIs on the Web Avrom Roy-Faderman Senior Programmer May, 2006.
JavaServer Faces Jeff Schmitt October 5, Introduction to JSF Presents a standard framework for building presentation tiers for web applications.
CSE446 S OFTWARE Q UALITY M ANAGEMENT Spring 2014 Yazılım ve Uyguluma Geliştirme Yöneticisi Orhan Başar Evren.
JSF road map (NI) Clientside validation Show problems
CSCI 6962: Server-side Design and Programming Introduction to Java Server Faces.
Web applications using JavaServer Faces (JSF) A brief introduction 1JavaServer Faces (JSF)
JSF Introduction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
CHEF II / Sakai Architecture. CHEF II Changes uPortal replaces Jetspeed –jsr 168 portlet, servlet compliant Spring replaces Turbine component framework.
Fall CIS 764 Database Systems Design L8. Web ….
Introduction to Web Dimitar Nenchev Ivan Nakov
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 5 JavaServer Faces (JSF) Technology.
Building Secure Web Applications With ASP.Net MVC.
JSF Framework Java Server Faces Presented by Songkran Totiya (6/10/2014)
JavaServer Faces (JSF) and Ajax Integration. Agenda 대강의 ( 정말로..) 개요 예제 아키텍트라면..
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
INTEGRATION OF BACKBONE.JS WITH SPRING 3.1. Agenda New Features and Enhancements in Spring 3.1 What is Backbone.js and why I should use it Spring 3.1.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
Securing Angular Apps Brian Noyes
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
The Sakai Architecture
JavaServer Faces framework Craig McClanahan is presented that created Struts web framework and based on experience gathered designed JavaServer.
Expect the Unexpected Kito D. Mann Principal Consultant.
UNDERSTANDING YOUR OPTIONS FOR CLIENT-SIDE DEVELOPMENT IN OFFICE 365 Mark Rackley
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Developing Rich Web Applications with.
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
Leveraging Web Content Management in SharePoint 2013 Christina Wheeler.
SDJ INFOSOFT PVT. LTD. 2 BROWSERBROWSER JSP JavaBean DB Req Res Application Layer Enterprise server/Data Sources.
Apache Struts Technology A MVC Framework for Java Web Applications.
The New Face of ASP.NET ASP.NET MVC, Razor, and jQuery Ido Flatow | Senior Architect | Sela | This session is.
Kito D. Mann Principal Consultant Advanced PrimeFaces.
Struts 2 Development. Topics  Roles in Struts Development  Control Flow  Actions  Struts 2 Views and Target  Struts 2 Custom Tags  Validation 
Intro to JavaServer Faces Mimi Opkins CECS 493 Fall 2016.
JavaServer Faces in Action
ORACLE ADF ONLINE TRAINING COURSE
TECHLEADS IT Oracle Apps ADF R12
Unit 6-Chapter 2 Struts.
Contemporary Java Web Applications with JSF 2.3 Ed Burns Java EE Specifications October 2017.
ISE 390 Dynamic Web Development
JavaServer Faces: The Fundamentals
Web Development Using ASP .NET
The JSF Tools Project – WTP (internal) release review
Presentation transcript:

JSF 2.2 Deep Dive Kito D. Mann Principal Consultant

Kito D. Principal Consultant at Virtua Training, consulting, architecture, mentoring, Official US PrimeFaces partner Author, JavaServer Faces in Action Founder, JSF Central Copyright (C) 2014 Virtua, Inc. All rights reserved.

Kito D. Co-host, Enterprise Java Newscast Internationally recognized speaker JavaOne, JavaZone, Devoxx, NFJS, TSSJS, etc. JCP Member JSF, CDI, JSF Portlet Bridge, Portlets Copyright (C) 2014 Virtua, Inc. All rights reserved.

What is JavaServer Faces? Server-side UI component framework Powerful MVC controller Server-side templating (Facelets) Copyright © Virtua, Inc All rights reserved.

What is JavaServer Faces? JSF 2.2 is part of Java EE 7 Also runs on Java EE 6 containers Servlet 3.0 required Graceful degradation for Java EE 7- specific features Example: JSR-353 JSON parsing Copyright © Virtua, Inc All rights reserved.

Components are the Key Components render HTML, CSS, and JavaScript Easy integration with server-side model Copyright © Virtua, Inc All rights reserved.

DEMO: COMPONENT SUITES + SPECIAL ANNOUNCEMENT Copyright © Virtua, Inc All rights reserved.

Key New Features HTML5 Friendly Markup Support Pass through attributes and elements Faces Flows Cross Site Request Forgery Protection Loading Facelets via ResourceHandler File Upload Component Resource Library Contracts (Multi- templating) Copyright © Virtua, Inc All rights reserved.

HTML5 Friendly Markup Makes it easy to support new browser features without writing a new component Use pure HTML and special attributes to indicate JSF components Copyright © Virtua, Inc All rights reserved.

HTML5 Friendly Markup Copyright © Virtua, Inc All rights reserved. <html xmlns=" xmlns:jsf=" xmlns:f=" xmlns:ui=" Putting it all together Name

HTML5 Friendly Markup Copyright © Virtua, Inc All rights reserved. Tel Progress

Pass through attributes and elements Passed through to the browser without interference from JSF Rendered on the top-most element for the component Copyright © Virtua, Inc All rights reserved.

HTML5 is the default HTML5 doctype rendered as default To turn it off in faces-config.xml: Copyright © Virtua, Inc All rights reserved..xhtml xhtml

Pass through attributes Copyright © Virtua, Inc All rights reserved. <html xmlns=" xmlns:pt=" xmlns:f=" xmlns:h=" xmlns:ui="

Pass through elements Copyright © Virtua, Inc All rights reserved. <html xmlns=" xmlns:jsf=" xmlns:f=" xmlns:h=" xmlns:ui=" <input type="password" jsf:id="passwordInput" pattern=".{5,}" size="20" maxlength="20" jsf:label="Password" title="This field must be at least 5 characters long." required="required" jsf:required="true" jsf:value="#{loginController.password}">...

DEMO: HTML5-FRIENDLY MARKUP Copyright © Virtua, Inc All rights reserved.

Stateless Views Views can now be marked as stateless Does not work with view scoped beans Copyright © Virtua, Inc All rights reserved.

Faces Flows Allows you to group sets of views together into logical navigation paths Built with ideas from existing solutions ADF Task Flows Spring Web Flow Apache MyFaces CODI Copyright © Virtua, Inc All rights reserved.

Faces Flows Think of a flow like a Java method Can be “called” from any place in the application Can accept input parameters and return values Copyright © Virtua, Inc All rights reserved.

Faces Flows Well defined interface contract Internal implementation details hidden New facesFlowScope for flow local storage CDI annotation: automatic activation/passivation Copyright © Virtua, Inc All rights reserved.

Faces Flows Navigation can now move between nodes Nodes have types: View Method Call Switch Flow Call Flow Return Copyright © Virtua, Inc All rights reserved.

Faces Flows Enables packaged, reusable application fragments Depends on new “client window” feature Requires CDI Copyright © Virtua, Inc All rights reserved.

Packaging Faces Flows my-flow.jar META-INF/beans.xml META- INF/flows/{flowName}/{flowName}- flow.xml META- INF/flows/{flowName}/{viewNode}.xhtm l {javaPackagePath}/{javaClassName}.clas s Copyright © Virtua, Inc All rights reserved.

DEMO: FACES FLOWS Copyright © Virtua, Inc All rights reserved.

Java Faces Flow Definition Copyright © Virtua, Inc All rights public class FlowA implements public Flow FlowBuilder flowBuilder) { String flowId = "flow-a"; flowBuilder.id("", flowId); flowBuilder.viewNode(flowId, "/" + flowId + "/" + flowId + ".xhtml").markAsStartNode(); flowBuilder.returnNode("taskFlowReturn1"). fromOutcome("#{flow_a_Bean.returnValue}"); flowBuilder.inboundParameter("param1FromFlowB", "#{flowScope.param1Value}"); flowBuilder.inboundParameter("param2FromFlowB", "#{flowScope.param2Value}");

Java Faces Flow Definition Copyright © Virtua, Inc All rights reserved. flowBuilder.flowCallNode("callB").flowReference("", "flow-b"). outboundParameter("param1FromFlowA", "param1Value"). outboundParameter("param2FromFlowA", "param2Value"); return flowBuilder.getFlow(); }

XML Faces Flow Definition Copyright © Virtua, Inc All rights reserved. #{flow_b_Bean.returnValue} param1FromFlowA #{flowScope.param1Value} param2FromFlowA #{flowScope.param2Value}

XML Faces Flow Definition Copyright © Virtua, Inc All rights reserved. flow-a param1FromFlowB param1Value param2FromFlowB param2Value

Copyright © Virtua, Inc All rights reserved. Cross-site request forgery, also known as a one- click attack or session riding and abbreviated as CSRF (sometimes pronounced “sea-surf”) or XSRF, is a type of malicious exploit of a website whereby unauthorized commands are transmitted from a user that the website trusts. Source:

Cross-site Request Forgery Protection JSF has always handled this via POST requests The ViewState is required for a request to be accepted JSF 2.2 encrypts the ViewState by default Copyright © Virtua, Inc All rights reserved.

Cross-site Request Forgery Protection GET requests handled with new element in navigation rules JSF ensures that protected views come from the same web application Copyright © Virtua, Inc All rights reserved.

Loading Facelets via ResourceHandler In JSF 2.0/2.1: ResourceHandler used for JavaScript, CSS, images etc. ResourceResolver used for Facelets JSF 2.2: Everything (including Facelets) loaded via ResourceHandler Copyright © Virtua, Inc All rights reserved.

File Upload Component File upload supported in Servlet 3.0 Third-party component suite have had file upload for a while Now supported as a component in JSF 2.2 Ajax and non-Ajax use cases will be supported Copyright © Virtua, Inc All rights reserved.

File Upload Component Copyright © Virtua, Inc All rights reserved. <h:inputFile id="file” value="#{fileUploadBean.uploadedFile}">

Resource Library Contracts (Multi-templating) Allows you to template site elements Header, sidebar, content area, footer, banner, CSS, images, etc. Packaged as JAR files Defines contracts Copyright © Virtua, Inc All rights reserved.

Resource Library Contracts (Multi-templating) Allows you to change global layout Useful for apps with per-client customization Copyright © Virtua, Inc All rights reserved.

Resource Library Contracts: JAR Contents Copyright © Virtua, Inc All rights reserved. META-INF/contracts/ siteLayout/ javax.faces.contract.xml topNav_template.xhtml leftNav_foo.xhtml styles.css script.js background.png subSiteLayout/ javax.faces.contract.xml sub_template.xhtml

Applying Resource Library Contracts Global (default) Copyright © Virtua, Inc All rights reserved.

Applying Resource Library Contracts Via paths in faces-config.xml: Copyright © Virtua, Inc All rights reserved. /user/* user * default

Applying Resource Library Contracts Per view (must be specified on outer- most file) Copyright © Virtua, Inc All rights reserved.

DEMO: RESOURCE LIBRARY CONTRACTS Copyright © Virtua, Inc All rights reserved.

Medium-sized Features Components/Renderers Component Managed EL Context ClientWindow Facelets HTML5 DOCTYPE is the default Programmatic Composite Component creation FaceletFactory API Lifecycle Copyright © Virtua, Inc All rights reserved.

Medium-sized Features View Actions Almost all artifacts injectable with Java EE resources or CDI PhaseListeners, factories, listeners, etc. Copyright © Virtua, Inc All rights reserved.

Medium-sized Features Full list: Copyright © Virtua, Inc All rights reserved.

View Actions Method called before a page is loaded Similar to preRenderView event, but has other features: Returns an outcome for navigation Can be executed at different phases of the lifecycle Copyright © Virtua, Inc All rights reserved.

DEMO: VIEW ACTIONS Copyright © Virtua, Inc All rights reserved.

Bug Fixes and Tweaks UIData now works with Collections instead of just Lists Composite and non-composite components can now be in the same taglib Copyright © Virtua, Inc All rights reserved.

Bug Fixes and Tweaks New events for Flash Scope PostKeepFlashValueEvent PostPutFlashValueEvent PreClearFlashEvent PreRemoveFlashEvent Full list: Copyright © Virtua, Inc All rights reserved.

Bug fixes and tweaks: URI Changes Copyright © Virtua, Inc All rights reserved. LibraryOld URINew URI Composite Components te e Faces Corehttp://java.sun.com/jsf/corehttp://xmlns.jcp.org/jsf/core HTML_BASIChttp://java.sun.com/jsf/htmlhttp://xmlns.jcp.org/jsf/html JSTL Corehttp://java.sun.com/jsp/jstl/corehttp://xmlns.jcp.org/jsp/jstl/core JSTL Functionshttp://java.sun.com/jsp/jstl/func tions tions Facelets Templating Pass Through Attributes ugh ugh Pass Through Elements

JSF 2.3 has Officially Begun Part of Java EE 8 Will depend on Java SE 8 No backward compatibility Managed beans will be FacesContext Copyright © Virtua, Inc All rights reserved.

JSF 2.3 has Officially Begun Multi-field validation Ajax method invocation EL optimization Better integration with client-side technologies and frameworks Copyright © Virtua, Inc All rights reserved.

Summary JSF 2.2 is part of Java EE 7 (released in Spring, 2013) Backwards compatible with Java EE 6 Copyright © Virtua, Inc All rights reserved.

Summary Key new features HTML5 Friendly Markup Support Faces Flows Cross Site Request Forgery Protection Loading Facelets via ResourceHandler File Upload Component Resource Library Contracts (Multi- templating) Copyright © Virtua, Inc All rights reserved.

Summary Medium-sized features: View Actions Better support for CDI and resource injection Client window Facelets tweaks Copyright © Virtua, Inc All rights reserved.

Summary Many other bug fixes and tweaks JSF 2.3 has just begun! Copyright © Virtua, Inc All rights reserved.