SlideShare uma empresa Scribd logo
Java EE 8 Web Frameworks
A Look at JavaServer Faces vs MVC
Josh Juneau
About Me
• Member of JSF 2.3 (JSR 372) EG
• Member of JSR 378 (Portlet 3.0 Bridge) EG
• Developer/Analyst/DBA @ Fermilab
• Apress Author
• OTN/Java Magazine Contributor
• Member of CJUG
• Java EE Guardians
Agenda
• Overview of JavaServer Faces & Demo
• Overview of MVC & Demo
• Feature Comparison
• JSF 2.3 Feature Overview
• Java EE 8 Overall Status
MVC Architecture
• Model = Data
• View = UI
• Controller = Business Logic
JavaServer Faces Overview
JavaServer Faces technology establishes the standard
for building server-side user interfaces for Java EE.
• An API for representing UI components and managing
their state; handling events, server-side validation, and
data conversion; defining page navigation; supporting
internationalization and accessibility; and providing
extensibility for all these features
• JavaServer Faces (JSF) custom tag libraries for
expressing UI components within a view and for wiring
components to server-side objects
JavaServer Faces Overview
The well-defined programming model and tag libraries
significantly ease the burden of building and maintaining web
applications with server-side UIs. With minimal effort, you can:
• Drop components onto a page by adding component tags
• Wire component-generated events to server-side application
code
• Bind UI components on a page to server-side data
• Construct a UI with reusable and extensible components
• Save and restore UI state beyond the life of server requests
JSF Models
Data tier to work with entity classes (POJOs that
map to database tables) to work with the
underlying database from within a Java EE
application.
• EJBs…no…not J2EE!!!!
• JAX-RS
JSF Views
• Tree of Components
• Facelets or HTML
• Expression Language
• Mix with JSTL and other tab libraries, as needed
• Component Libraries
JSF Views
JSF Data Validation
• Bean Validation
• Faces Validator
JSF Controllers
• Business logic - FacesServlet
• CDI Scopes…No More JSF @ManagedBean
• SessionScoped, ApplicationScoped,
ViewScoped, RequestScoped,
ConversationScoped, FlowScoped,
Dependent, Singleton
• Contextual…State Managed Across Requests
JSF Typical Form Submit
Procedure
• User completes form entry by populating form
components.
• User clicks a commandButton, which invokes a
server-side method, and the CDI bean values
are submitted to FacesServlet for processing.
• Action method performs its work and then
returns control to FacesServlet for navigation.
JSF Lifecycle
• Restore View Phase
• Apply Request Values Phase
• Process Validations Phase
• Update Model Values Phase
• Invoke Application Phase
• Render Response Phase
JSF Lifecycle
JSF Ajax Support
• f:ajax for invoking server-side functionality
• Many third-party UI frameworks
JSF
JSF in Action!
JSR 371: MVC 1.0
https://ozark.java.net/
• Action-oriented framework layered on top of JAX-RS
• Manual controller logic…you control your own destiny!
• No UI Components
• You choose your front end technology
MVC 1.0
Models
Utilize entity classes for data, or store into CDI bean
Two ways to work with models:
• javax.mvc.Models class
• CDI-Based Models
MVC 1.0
Views
ViewEngine Used to Merge Model and View
• Utilize a number of different view technologies
• Ozark Ships with 3 Implementations
• Views reside within WEB-INF/views folder
MVC 1.0
Views
MVC 1.0
Validating Data
• Manual Validation
• Bean Validation
MVC 1.0
Controllers
• Controls the request-processing for an MVC
application.
• JAX-RS Implementation
• Class annotated with @Controller either at class level
or method level.
• Must be CDI Managed
• Possible to create hybrid classes (@Controller at
method level)
MVC 1.0
Controllers
• Four return types: String, void, Response, Viewable
• String: returns path to view
• void: requires @javax.mvc.View annotation
• Response: typical javax.ws.rs.core.Response, providing
access to the response
• Viewable: javax.mvc.Viewable containing information ab
the view and how to process
• Default response type text/html, but can be modified with
@Produces
MVC 1.0
Controllers
MVC 1.0
Views to Controllers - Parameters
Parameters handled via annotations in Controller:
• @PathParam: Used to extract path parameters
• @FormParam: Used to process fields from form
• @QueryParam: Used when parameters appended to
URL
• @BeanParam: Used to inject various request
parameters into a bean
MVC 1.0
Views - Redirecting Responses
• JAX-RS
return
Response.seeOther(URI.create(“redirectView”)).build()
• MVC
return “redirect:redirectView”
@RedirectScoped Annotation
• Bean will span at most two requests
• Must be Serializable
MVC 1.0
Exception Handling
• Can be applied via try/catch at method level or
globally
return Response.status(BAD_REQUEST).entity("error.jsp").build();
• ExceptionMapper class
MVC 1.0
Security
• Utilize ${mvc.csrf.name} and ${mvc.csrf.token} in
form
• javax.mvc.security.CsrfProtection property
• @CsrfValid Annotation at Method Level
MVC 1.0
MVC in Action!
JSF or MVC?
JSF MVC
• Component Based
• Controller Logic
Automates Processing
• Facelets
• Rapid Development
• Works well with REST
• Stateful…remains across
requests
• Action Based
• Layered on Top of JAX-RS
• Manual Validations/
Conversions
• Many Different View Options
• Fine Control Request/
Response
• Great fit for REST
• No State Across Requests
JSR 372: JSF 2.3
Not forgotten with Java EE 8
While scope of update is not very large, new features
and enhancements will help continue making JSF
relevant in today’s world.
Thanks to the OmniFaces folks for adding a number of
features to JSF.
JSF 2.3 in Java EE 8
• Two feature drivers: Oracle & Community
• Feature clean-up
• Small new feature set based upon community requests
• Mature standard for building Java EE applications
JSF 2.3 - Oracle Focus
Tie up loose ends:
• Specification clarifications
• CDI Alignment
• Others
Small Scale New Features:
• CDI Managed Beans Only
• Ajax Method Invocation
• Multi-component Validation
JSF 2.3 - Community Focus
• JSON Ajax Component Rendering
• Stateless enhancements
• GET Enhancements
• Push Support
JSF 2.3 New Features
(Implemented)
• Inject ViewMap
@ViewMap
@Inject
Map viewMap;
• Inject UiViewRoot
@Inject
UIViewRoot viewRoot;
• #1332 - Let CDI handle #{view}
• #1331 - Let CDI handle #{application}
• #1254 - contracts attribute too restrictive.
JSF 2.3 New Features
(Implemented - ctd)
• #1328 - Let CDI handle #{session} EL resolving
• #1325 - Let CDI handle #{applicationScope}
• #1311 - Let CDI handle #{facesContext} EL resolving
• #1323 - Support @Inject for the applicationMap
@ApplicationMap
@Inject
Map applicationMap;
• #1322 - Simplify #{externalContext} to use
ExternalContextProducer
JSF 2.3 New Features
(Implemented - ctd)
• #1309 - Support @Inject for ExternalContext
@Inject ExternalContext externalContext;
• #527 - Support @Inject for FacesContext
@Inject FacesContext facesContext;
• javax.faces.bean.ManagedProperty Replacement
JSF 2.3 New Features
(Implemented - ctd)
• #1396 - f:socket for SSE and WebSocket
http://jj-blogger.blogspot.com/2016/02/a-look-at-
upcoming-jsf-23-push-support.html
Learn More
What Is The CJUG?
Chicago Java Users Group is dedicated to the
helping you learn and network.
• Technology community second to none.
• Learn and contribute to Java / JVM ecosystem
• Mentorship and career opportunities
• Have fun and build cool things
Java EE Guardians
Join us and help move Java EE into the future!
Contact
Josh Juneau
- Java EE 7 Recipes
- Introducing Java EE 7
- JavaServer Faces: Introduction By Example
- Java 8 Recipes
Twitter: @javajuneau
Read On!

Mais conteúdo relacionado

Mais procurados

Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
Hùng Nguyễn Huy
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
Dzmitry Naskou
 
Spring framework
Spring frameworkSpring framework
Spring framework
Aircon Chen
 
Spring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerSpring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen Hoeller
ZeroTurnaround
 
50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutes50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutes
Arun Gupta
 
Spring 3 MVC CodeMash 2009
Spring 3 MVC   CodeMash 2009Spring 3 MVC   CodeMash 2009
Spring 3 MVC CodeMash 2009
kensipe
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
tola99
 
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlJava Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Arjun Thakur
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introduction
ejlp12
 
Java EE vs Spring Framework
Java  EE vs Spring Framework Java  EE vs Spring Framework
Java EE vs Spring Framework
Rohit Kelapure
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
Raveendra R
 
Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the Horizon
Josh Juneau
 
Java EE 7 - Overview and Status
Java EE 7  - Overview and StatusJava EE 7  - Overview and Status
Java EE 7 - Overview and Status
Java Usergroup Berlin-Brandenburg
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVC
John Lewis
 
Lecture 10 - Java Server Faces (JSF)
Lecture 10 - Java Server Faces (JSF)Lecture 10 - Java Server Faces (JSF)
Lecture 10 - Java Server Faces (JSF)
Fahad Golra
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC framework
Mohit Gupta
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
Serhat Can
 
JSF basics
JSF basicsJSF basics
JSF basics
airbo
 
Spring Framework Rohit
Spring Framework RohitSpring Framework Rohit
Spring Framework Rohit
Rohit Prabhakar
 
스프링 프레임워크
스프링 프레임워크스프링 프레임워크
스프링 프레임워크
Yoonki Chang
 

Mais procurados (20)

Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Spring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerSpring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen Hoeller
 
50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutes50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutes
 
Spring 3 MVC CodeMash 2009
Spring 3 MVC   CodeMash 2009Spring 3 MVC   CodeMash 2009
Spring 3 MVC CodeMash 2009
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlJava Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introduction
 
Java EE vs Spring Framework
Java  EE vs Spring Framework Java  EE vs Spring Framework
Java EE vs Spring Framework
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the Horizon
 
Java EE 7 - Overview and Status
Java EE 7  - Overview and StatusJava EE 7  - Overview and Status
Java EE 7 - Overview and Status
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVC
 
Lecture 10 - Java Server Faces (JSF)
Lecture 10 - Java Server Faces (JSF)Lecture 10 - Java Server Faces (JSF)
Lecture 10 - Java Server Faces (JSF)
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC framework
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
JSF basics
JSF basicsJSF basics
JSF basics
 
Spring Framework Rohit
Spring Framework RohitSpring Framework Rohit
Spring Framework Rohit
 
스프링 프레임워크
스프링 프레임워크스프링 프레임워크
스프링 프레임워크
 

Semelhante a Java EE 8 Web Frameworks: A Look at JSF vs MVC

JSF2
JSF2JSF2
Spring mvc
Spring mvcSpring mvc
Spring mvc
Pravin Pundge
 
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGOverview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Marakana Inc.
 
MVC 1.0 als alternative Webtechnologie
MVC 1.0 als alternative WebtechnologieMVC 1.0 als alternative Webtechnologie
MVC 1.0 als alternative Webtechnologie
OPEN KNOWLEDGE GmbH
 
Utilizing JSF Front Ends with Microservices
Utilizing JSF Front Ends with MicroservicesUtilizing JSF Front Ends with Microservices
Utilizing JSF Front Ends with Microservices
Josh Juneau
 
Java EE8 - by Kito Mann
Java EE8 - by Kito Mann Java EE8 - by Kito Mann
Java EE8 - by Kito Mann
Kile Niklawski
 
Asp.net mvc basic introduction
Asp.net mvc basic introductionAsp.net mvc basic introduction
Asp.net mvc basic introduction
Bhagath Gopinath
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
Rohit Kelapure
 
Mvc fundamental
Mvc fundamentalMvc fundamental
Mvc fundamental
Nguyễn Thành Phát
 
Glassfish JEE Server Administration - JEE Introduction
Glassfish JEE Server Administration - JEE IntroductionGlassfish JEE Server Administration - JEE Introduction
Glassfish JEE Server Administration - JEE Introduction
Danairat Thanabodithammachari
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
Mukesh Kumar
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVC
Sagar Kamate
 
AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7
WASdev Community
 
AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7
Kevin Sutter
 
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
Kevin Sutter
 
MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming model
Alex Thissen
 
MVC + ORM (with project implementation)
MVC + ORM (with project implementation)MVC + ORM (with project implementation)
MVC + ORM (with project implementation)
Prateek Chauhan
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
Max Yekaterynenko - Magento Architecture, Next Steps
Max Yekaterynenko - Magento Architecture, Next StepsMax Yekaterynenko - Magento Architecture, Next Steps
Max Yekaterynenko - Magento Architecture, Next Steps
Meet Magento Italy
 
Java EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConJava EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseCon
Ludovic Champenois
 

Semelhante a Java EE 8 Web Frameworks: A Look at JSF vs MVC (20)

JSF2
JSF2JSF2
JSF2
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGOverview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUG
 
MVC 1.0 als alternative Webtechnologie
MVC 1.0 als alternative WebtechnologieMVC 1.0 als alternative Webtechnologie
MVC 1.0 als alternative Webtechnologie
 
Utilizing JSF Front Ends with Microservices
Utilizing JSF Front Ends with MicroservicesUtilizing JSF Front Ends with Microservices
Utilizing JSF Front Ends with Microservices
 
Java EE8 - by Kito Mann
Java EE8 - by Kito Mann Java EE8 - by Kito Mann
Java EE8 - by Kito Mann
 
Asp.net mvc basic introduction
Asp.net mvc basic introductionAsp.net mvc basic introduction
Asp.net mvc basic introduction
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
 
Mvc fundamental
Mvc fundamentalMvc fundamental
Mvc fundamental
 
Glassfish JEE Server Administration - JEE Introduction
Glassfish JEE Server Administration - JEE IntroductionGlassfish JEE Server Administration - JEE Introduction
Glassfish JEE Server Administration - JEE Introduction
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVC
 
AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7
 
AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7
 
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
 
MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming model
 
MVC + ORM (with project implementation)
MVC + ORM (with project implementation)MVC + ORM (with project implementation)
MVC + ORM (with project implementation)
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
Max Yekaterynenko - Magento Architecture, Next Steps
Max Yekaterynenko - Magento Architecture, Next StepsMax Yekaterynenko - Magento Architecture, Next Steps
Max Yekaterynenko - Magento Architecture, Next Steps
 
Java EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConJava EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseCon
 

Mais de Josh Juneau

Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Migrating to Jakarta EE 10
Migrating to Jakarta EE 10
Josh Juneau
 
Jakarta EE Recipes
Jakarta EE RecipesJakarta EE Recipes
Jakarta EE Recipes
Josh Juneau
 
Jakarta EE and MicroProfile Tech Talk
Jakarta EE and MicroProfile Tech TalkJakarta EE and MicroProfile Tech Talk
Jakarta EE and MicroProfile Tech Talk
Josh Juneau
 
Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020
Josh Juneau
 
Jakarta EE 8: Overview of Features
Jakarta EE 8: Overview of FeaturesJakarta EE 8: Overview of Features
Jakarta EE 8: Overview of Features
Josh Juneau
 
Lightweight Java EE with MicroProfile
Lightweight Java EE with MicroProfileLightweight Java EE with MicroProfile
Lightweight Java EE with MicroProfile
Josh Juneau
 
Java EE 7 Recipes
Java EE 7 RecipesJava EE 7 Recipes
Java EE 7 Recipes
Josh Juneau
 
Java EE 7 Recipes for Concurrency - JavaOne 2014
Java EE 7 Recipes for Concurrency - JavaOne 2014Java EE 7 Recipes for Concurrency - JavaOne 2014
Java EE 7 Recipes for Concurrency - JavaOne 2014
Josh Juneau
 

Mais de Josh Juneau (8)

Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Migrating to Jakarta EE 10
Migrating to Jakarta EE 10
 
Jakarta EE Recipes
Jakarta EE RecipesJakarta EE Recipes
Jakarta EE Recipes
 
Jakarta EE and MicroProfile Tech Talk
Jakarta EE and MicroProfile Tech TalkJakarta EE and MicroProfile Tech Talk
Jakarta EE and MicroProfile Tech Talk
 
Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020
 
Jakarta EE 8: Overview of Features
Jakarta EE 8: Overview of FeaturesJakarta EE 8: Overview of Features
Jakarta EE 8: Overview of Features
 
Lightweight Java EE with MicroProfile
Lightweight Java EE with MicroProfileLightweight Java EE with MicroProfile
Lightweight Java EE with MicroProfile
 
Java EE 7 Recipes
Java EE 7 RecipesJava EE 7 Recipes
Java EE 7 Recipes
 
Java EE 7 Recipes for Concurrency - JavaOne 2014
Java EE 7 Recipes for Concurrency - JavaOne 2014Java EE 7 Recipes for Concurrency - JavaOne 2014
Java EE 7 Recipes for Concurrency - JavaOne 2014
 

Último

03. Ruby Variables & Regex - Ruby Core Teaching
03. Ruby Variables & Regex - Ruby Core Teaching03. Ruby Variables & Regex - Ruby Core Teaching
03. Ruby Variables & Regex - Ruby Core Teaching
quanhoangd129
 
Fantastic Design Patterns and Where to use them No Notes.pdf
Fantastic Design Patterns and Where to use them No Notes.pdfFantastic Design Patterns and Where to use them No Notes.pdf
Fantastic Design Patterns and Where to use them No Notes.pdf
6m9p7qnjj8
 
🚂🚘 Premium Girls Call Ranchi 🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
🚂🚘 Premium Girls Call Ranchi  🛵🚡000XX00000 💃 Choose Best And Top Girl Service...🚂🚘 Premium Girls Call Ranchi  🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
🚂🚘 Premium Girls Call Ranchi 🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
bahubalikumar09988
 
06. Ruby Array & Hash - Ruby Core Teaching
06. Ruby Array & Hash - Ruby Core Teaching06. Ruby Array & Hash - Ruby Core Teaching
06. Ruby Array & Hash - Ruby Core Teaching
quanhoangd129
 
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
87tomato
 
Russian Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service ...
Russian Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service ...Russian Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service ...
Russian Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service ...
shanihomely
 
Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...
Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...
Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...
norina2645
 
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
OnePlan Solutions
 
GT degree offer diploma Transcript
GT degree offer diploma TranscriptGT degree offer diploma Transcript
GT degree offer diploma Transcript
attueb
 
Tour and travel website management in odoo,
Tour and travel website management in odoo,Tour and travel website management in odoo,
Tour and travel website management in odoo,
Axis Technolabs
 
PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)
PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)
PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)
andrehoraa
 
07. Ruby String Slides - Ruby Core Teaching
07. Ruby String Slides - Ruby Core Teaching07. Ruby String Slides - Ruby Core Teaching
07. Ruby String Slides - Ruby Core Teaching
quanhoangd129
 
01. Ruby Introduction - Ruby Core Teaching
01. Ruby Introduction - Ruby Core Teaching01. Ruby Introduction - Ruby Core Teaching
01. Ruby Introduction - Ruby Core Teaching
quanhoangd129
 
Applitools Autonomous 2.0 Sneak Peek.pdf
Applitools Autonomous 2.0 Sneak Peek.pdfApplitools Autonomous 2.0 Sneak Peek.pdf
Applitools Autonomous 2.0 Sneak Peek.pdf
Applitools
 
Authentication Review-June -2024 AP & TS.pptx
Authentication Review-June -2024 AP & TS.pptxAuthentication Review-June -2024 AP & TS.pptx
Authentication Review-June -2024 AP & TS.pptx
DEMONDUOS
 
Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...
kiara pandey
 
09. Ruby Object Oriented Programming - Ruby Core Teaching
09. Ruby Object Oriented Programming - Ruby Core Teaching09. Ruby Object Oriented Programming - Ruby Core Teaching
09. Ruby Object Oriented Programming - Ruby Core Teaching
quanhoangd129
 
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
rachitkumar09887
 
Empowering Businesses with Intelligent Software Solutions - Grawlix
Empowering Businesses with Intelligent Software Solutions - GrawlixEmpowering Businesses with Intelligent Software Solutions - Grawlix
Empowering Businesses with Intelligent Software Solutions - Grawlix
Aarisha Shaikh
 
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdfAI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
Daniel Zivkovic
 

Último (20)

03. Ruby Variables & Regex - Ruby Core Teaching
03. Ruby Variables & Regex - Ruby Core Teaching03. Ruby Variables & Regex - Ruby Core Teaching
03. Ruby Variables & Regex - Ruby Core Teaching
 
Fantastic Design Patterns and Where to use them No Notes.pdf
Fantastic Design Patterns and Where to use them No Notes.pdfFantastic Design Patterns and Where to use them No Notes.pdf
Fantastic Design Patterns and Where to use them No Notes.pdf
 
🚂🚘 Premium Girls Call Ranchi 🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
🚂🚘 Premium Girls Call Ranchi  🛵🚡000XX00000 💃 Choose Best And Top Girl Service...🚂🚘 Premium Girls Call Ranchi  🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
🚂🚘 Premium Girls Call Ranchi 🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
 
06. Ruby Array & Hash - Ruby Core Teaching
06. Ruby Array & Hash - Ruby Core Teaching06. Ruby Array & Hash - Ruby Core Teaching
06. Ruby Array & Hash - Ruby Core Teaching
 
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
 
Russian Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service ...
Russian Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service ...Russian Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service ...
Russian Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service ...
 
Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...
Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...
Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...
 
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
 
GT degree offer diploma Transcript
GT degree offer diploma TranscriptGT degree offer diploma Transcript
GT degree offer diploma Transcript
 
Tour and travel website management in odoo,
Tour and travel website management in odoo,Tour and travel website management in odoo,
Tour and travel website management in odoo,
 
PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)
PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)
PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)
 
07. Ruby String Slides - Ruby Core Teaching
07. Ruby String Slides - Ruby Core Teaching07. Ruby String Slides - Ruby Core Teaching
07. Ruby String Slides - Ruby Core Teaching
 
01. Ruby Introduction - Ruby Core Teaching
01. Ruby Introduction - Ruby Core Teaching01. Ruby Introduction - Ruby Core Teaching
01. Ruby Introduction - Ruby Core Teaching
 
Applitools Autonomous 2.0 Sneak Peek.pdf
Applitools Autonomous 2.0 Sneak Peek.pdfApplitools Autonomous 2.0 Sneak Peek.pdf
Applitools Autonomous 2.0 Sneak Peek.pdf
 
Authentication Review-June -2024 AP & TS.pptx
Authentication Review-June -2024 AP & TS.pptxAuthentication Review-June -2024 AP & TS.pptx
Authentication Review-June -2024 AP & TS.pptx
 
Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...
 
09. Ruby Object Oriented Programming - Ruby Core Teaching
09. Ruby Object Oriented Programming - Ruby Core Teaching09. Ruby Object Oriented Programming - Ruby Core Teaching
09. Ruby Object Oriented Programming - Ruby Core Teaching
 
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
 
Empowering Businesses with Intelligent Software Solutions - Grawlix
Empowering Businesses with Intelligent Software Solutions - GrawlixEmpowering Businesses with Intelligent Software Solutions - Grawlix
Empowering Businesses with Intelligent Software Solutions - Grawlix
 
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdfAI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
 

Java EE 8 Web Frameworks: A Look at JSF vs MVC

  • 1. Java EE 8 Web Frameworks A Look at JavaServer Faces vs MVC Josh Juneau
  • 2. About Me • Member of JSF 2.3 (JSR 372) EG • Member of JSR 378 (Portlet 3.0 Bridge) EG • Developer/Analyst/DBA @ Fermilab • Apress Author • OTN/Java Magazine Contributor • Member of CJUG • Java EE Guardians
  • 3. Agenda • Overview of JavaServer Faces & Demo • Overview of MVC & Demo • Feature Comparison • JSF 2.3 Feature Overview • Java EE 8 Overall Status
  • 4. MVC Architecture • Model = Data • View = UI • Controller = Business Logic
  • 5. JavaServer Faces Overview JavaServer Faces technology establishes the standard for building server-side user interfaces for Java EE. • An API for representing UI components and managing their state; handling events, server-side validation, and data conversion; defining page navigation; supporting internationalization and accessibility; and providing extensibility for all these features • JavaServer Faces (JSF) custom tag libraries for expressing UI components within a view and for wiring components to server-side objects
  • 6. JavaServer Faces Overview The well-defined programming model and tag libraries significantly ease the burden of building and maintaining web applications with server-side UIs. With minimal effort, you can: • Drop components onto a page by adding component tags • Wire component-generated events to server-side application code • Bind UI components on a page to server-side data • Construct a UI with reusable and extensible components • Save and restore UI state beyond the life of server requests
  • 7. JSF Models Data tier to work with entity classes (POJOs that map to database tables) to work with the underlying database from within a Java EE application. • EJBs…no…not J2EE!!!! • JAX-RS
  • 8. JSF Views • Tree of Components • Facelets or HTML • Expression Language • Mix with JSTL and other tab libraries, as needed • Component Libraries
  • 10. JSF Data Validation • Bean Validation • Faces Validator
  • 11. JSF Controllers • Business logic - FacesServlet • CDI Scopes…No More JSF @ManagedBean • SessionScoped, ApplicationScoped, ViewScoped, RequestScoped, ConversationScoped, FlowScoped, Dependent, Singleton • Contextual…State Managed Across Requests
  • 12. JSF Typical Form Submit Procedure • User completes form entry by populating form components. • User clicks a commandButton, which invokes a server-side method, and the CDI bean values are submitted to FacesServlet for processing. • Action method performs its work and then returns control to FacesServlet for navigation.
  • 13. JSF Lifecycle • Restore View Phase • Apply Request Values Phase • Process Validations Phase • Update Model Values Phase • Invoke Application Phase • Render Response Phase
  • 15. JSF Ajax Support • f:ajax for invoking server-side functionality • Many third-party UI frameworks
  • 17. JSR 371: MVC 1.0 https://ozark.java.net/ • Action-oriented framework layered on top of JAX-RS • Manual controller logic…you control your own destiny! • No UI Components • You choose your front end technology
  • 18. MVC 1.0 Models Utilize entity classes for data, or store into CDI bean Two ways to work with models: • javax.mvc.Models class • CDI-Based Models
  • 19. MVC 1.0 Views ViewEngine Used to Merge Model and View • Utilize a number of different view technologies • Ozark Ships with 3 Implementations • Views reside within WEB-INF/views folder
  • 21. MVC 1.0 Validating Data • Manual Validation • Bean Validation
  • 22. MVC 1.0 Controllers • Controls the request-processing for an MVC application. • JAX-RS Implementation • Class annotated with @Controller either at class level or method level. • Must be CDI Managed • Possible to create hybrid classes (@Controller at method level)
  • 23. MVC 1.0 Controllers • Four return types: String, void, Response, Viewable • String: returns path to view • void: requires @javax.mvc.View annotation • Response: typical javax.ws.rs.core.Response, providing access to the response • Viewable: javax.mvc.Viewable containing information ab the view and how to process • Default response type text/html, but can be modified with @Produces
  • 25. MVC 1.0 Views to Controllers - Parameters Parameters handled via annotations in Controller: • @PathParam: Used to extract path parameters • @FormParam: Used to process fields from form • @QueryParam: Used when parameters appended to URL • @BeanParam: Used to inject various request parameters into a bean
  • 26. MVC 1.0 Views - Redirecting Responses • JAX-RS return Response.seeOther(URI.create(“redirectView”)).build() • MVC return “redirect:redirectView” @RedirectScoped Annotation • Bean will span at most two requests • Must be Serializable
  • 27. MVC 1.0 Exception Handling • Can be applied via try/catch at method level or globally return Response.status(BAD_REQUEST).entity("error.jsp").build(); • ExceptionMapper class
  • 28. MVC 1.0 Security • Utilize ${mvc.csrf.name} and ${mvc.csrf.token} in form • javax.mvc.security.CsrfProtection property • @CsrfValid Annotation at Method Level
  • 29. MVC 1.0 MVC in Action!
  • 30. JSF or MVC? JSF MVC • Component Based • Controller Logic Automates Processing • Facelets • Rapid Development • Works well with REST • Stateful…remains across requests • Action Based • Layered on Top of JAX-RS • Manual Validations/ Conversions • Many Different View Options • Fine Control Request/ Response • Great fit for REST • No State Across Requests
  • 31. JSR 372: JSF 2.3 Not forgotten with Java EE 8 While scope of update is not very large, new features and enhancements will help continue making JSF relevant in today’s world. Thanks to the OmniFaces folks for adding a number of features to JSF.
  • 32. JSF 2.3 in Java EE 8 • Two feature drivers: Oracle & Community • Feature clean-up • Small new feature set based upon community requests • Mature standard for building Java EE applications
  • 33. JSF 2.3 - Oracle Focus Tie up loose ends: • Specification clarifications • CDI Alignment • Others Small Scale New Features: • CDI Managed Beans Only • Ajax Method Invocation • Multi-component Validation
  • 34. JSF 2.3 - Community Focus • JSON Ajax Component Rendering • Stateless enhancements • GET Enhancements • Push Support
  • 35. JSF 2.3 New Features (Implemented) • Inject ViewMap @ViewMap @Inject Map viewMap; • Inject UiViewRoot @Inject UIViewRoot viewRoot; • #1332 - Let CDI handle #{view} • #1331 - Let CDI handle #{application} • #1254 - contracts attribute too restrictive.
  • 36. JSF 2.3 New Features (Implemented - ctd) • #1328 - Let CDI handle #{session} EL resolving • #1325 - Let CDI handle #{applicationScope} • #1311 - Let CDI handle #{facesContext} EL resolving • #1323 - Support @Inject for the applicationMap @ApplicationMap @Inject Map applicationMap; • #1322 - Simplify #{externalContext} to use ExternalContextProducer
  • 37. JSF 2.3 New Features (Implemented - ctd) • #1309 - Support @Inject for ExternalContext @Inject ExternalContext externalContext; • #527 - Support @Inject for FacesContext @Inject FacesContext facesContext; • javax.faces.bean.ManagedProperty Replacement
  • 38. JSF 2.3 New Features (Implemented - ctd) • #1396 - f:socket for SSE and WebSocket http://jj-blogger.blogspot.com/2016/02/a-look-at- upcoming-jsf-23-push-support.html
  • 40. What Is The CJUG? Chicago Java Users Group is dedicated to the helping you learn and network. • Technology community second to none. • Learn and contribute to Java / JVM ecosystem • Mentorship and career opportunities • Have fun and build cool things
  • 41. Java EE Guardians Join us and help move Java EE into the future!
  • 42. Contact Josh Juneau - Java EE 7 Recipes - Introducing Java EE 7 - JavaServer Faces: Introduction By Example - Java 8 Recipes Twitter: @javajuneau