JSF 2.2 in Action Kito D. Mann Principal Consultant.

Slides:



Advertisements
Similar presentations
Pierre-Johan CHARTRE Java EE - JAX-RS - Pierre-Johan CHARTRE
Advertisements

By Loukik Purohit & Rohit Ghatol
JSF Portlet Backing Beans and UI Components Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in.
Web Development with Karsten Schulz Terp-Nielsen Master Principal Sales Consultant Oracle Denmark.
Extreme User Interfaces for Alfresco Kevin Dorr Sr. Solutions Engineer Americas Channel.
Apache Struts Technology
MVC in JavaEE 8 Manfred Riem Principal Member of Technical Staff September, 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Kito D. Mann Principal Consultant Prime Time JSF with PrimeFaces 5.
Web applications using JavaServer Faces (JSF) A brief introduction 1JavaServer Faces (JSF)
Internet Technologies 1 Master of Information System Management Java Server Faces Model/View/Controller Design Pattern for Web Development Slides.
Stateful Web Application Development with Spring Web Flow John Case Senior Consultant Centare Group, Ltd.
UNIT-V The MVC architecture and Struts Framework.
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.
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.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
JDeveloper 10g and JavaServer Faces: High-Performance UIs on the Web Avrom Roy-Faderman Senior Programmer May, 2006.
CSE446 S OFTWARE Q UALITY M ANAGEMENT Spring 2014 Yazılım ve Uyguluma Geliştirme Yöneticisi Orhan Başar Evren.
CSCI 6962: Server-side Design and Programming Introduction to Java Server Faces.
Lecture 19 Web Application Frameworks Boriana Koleva Room: C54
Web applications using JavaServer Faces (JSF) A brief introduction 1JavaServer Faces (JSF)
CSCI 6962: Server-side Design and Programming Web Services.
JSF 2.2 Deep Dive Kito D. Mann Principal Consultant.
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 ….
OWASP Top Ten #1 Unvalidated Input. Agenda What is the OWASP Top 10? Where can I find it? What is Unvalidated Input? What environments are effected? How.
Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems.
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)
GLOCO – Integrated Corporate Portal Part 2 - Technical Specification Presented by Team 3 1 Team 3 Members: Joyce Torres Kenneth Kittredge Pamela Fisher.
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
Web dialogs as drop-in components Håkan Dahl, Callista Enterprise AB Killing the monolithic webapp.
Web Technologies Lecture 3 Web forms. HTML5 forms A component of a webpage that has form controls – Text fields – Buttons – Checkboxes – Range controls.
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.
Securing Angular Apps Brian Noyes
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
JavaServer Faces framework Craig McClanahan is presented that created Struts web framework and based on experience gathered designed JavaServer.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Expect the Unexpected Kito D. Mann Principal Consultant.
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.
SDJ INFOSOFT PVT. LTD. 2 BROWSERBROWSER JSP JavaBean DB Req Res Application Layer Enterprise server/Data Sources.
The New Face of ASP.NET ASP.NET MVC, Razor, and jQuery Ido Flatow | Senior Architect | Sela | This session is.
Business Applications– Using Java _____ Presented by Priya Saha.
Kito D. Mann Principal Consultant Advanced PrimeFaces.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 9 Case Study.
Social Enablement of Xpages - Linoy K George & Mervin Thomas.
Project Dynamic Faces World Class AJAX for JavaServer™ Faces Technology Ed Burns Senior Staff Engineer Enterprise Java Platforms.
J2EE Platform Overview (Application Architecture)
JavaServer Faces in Action
Building Secure ColdFusion Applications
World Wide Web policy.
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
Intro to J2EE Concepts.
Presentation transcript:

JSF 2.2 in Action 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.

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.

Java 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 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.