SlideShare a Scribd company logo
Jsf 2
 JSF 2 Hello World using Maven
 Java Server Faces (JSF) is a standard Java
framework for building user interfaces for Java
Web
applications. It combines an MVC design
approach with a standard component based UI
development framework.
 In this tutorial, we will create our first JSF 2
application using Maven. We will have a web page
with a text box and a submit button, so when the
user types a value inside the text field and click
the button, he will be forwarded to another page
that will display the submitted text field value.
 JavaServer Faces (JSF) is a Java-based web
application framework intended to simplify
development integration of web-based user
interfaces. JavaServer Faces is a standardized
display technology which was formalized in a
specification through the Java Community
Process.
 JSF technology is a framework for developing,
building server side User Interface Components and
using them in a web application.JSF technology is
based on the Model View Controller (MVC)
architecture for separating logic from presentation.
 What is MVC Design Pattern?
 MVC design pattern designs an application using
three separate modules:
 Module Description
 Model Carries Data and login
 View Shows User Interface
 ControllerHandles processing of an application.
 JSF Architecture
 A JSF application is similar to any other Java technology-based
web application; it runs in a Java servlet container, and contains
 JavaBeans components as models containing application-specific
functionality and data
 A custom tag library for representing event handlers and
validators
 A custom tag library for rendering UI components
 UI components represented as stateful objects on the server
 Server-side helper classes
 Validators, event handlers, and navigation handlers
 Application configuration resource file for configuring
application resources
 JSF application lifecycle consist of six phases which
are as follows
 Restore view phase
 Apply request values phase; process events
 Process validations phase; process events
 Update model values phase; process events
 Invoke application phase; process events
 Render response phase
 JSF begins the restore view phase as soon as a link or
a button is clicked and JSF receives a request.
 The JSF builds the view, wires event handlers and
validators to UI components and saves the view in the
FacesContext instance. The FacesContext instance
will now contains all the information required to
process a request.
Jsf 2
 File : index.xhtml
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
 xmlns:h="http://java.sun.com/jsf/html">
 <h:body>
 <h1>JSF2-InputText-Example</h1>
 <h:form>
 Name: <h:inputText value="#{user.name}" />
 <h:commandButton action="welcome" value="Display my
name" />
 </h:form>
 </h:body>
 </html>
 File : welcome.xhtml
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
 xmlns:h="http://java.sun.com/jsf/html">

 <h:body>
 <h3>
 Welcome <h:outputText value="#{user.name}" />!
 </h3>
 </h:body>
 </html>
 import javax.faces.bean.ManagedBean;

 @ManagedBean
 public class User {

 private String name;

 public String getName() {
 return name;
 }

 public void setName(String name) {
 this.name = name;
 }
 }
 Create a JSF page
 Create a page home.xhtml under webapp folder.
Update the code of home.xhtml as shown below.
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>JSF Tutorial!</title>
 </head>
 <body>
 #{helloWorld.getMessage()}
 </body>
 </html>
Jsf 2
Ad

More Related Content

What's hot (20)

What is MVC?
What is MVC?What is MVC?
What is MVC?
Dom Cimafranca
 
Jsp with mvc
Jsp with mvcJsp with mvc
Jsp with mvc
vamsitricks
 
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Rishu Mehra
 
MVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,MobileMVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,Mobile
naral
 
MVC Architecture
MVC ArchitectureMVC Architecture
MVC Architecture
Prasanna Venkatesh
 
Session 1
Session 1Session 1
Session 1
Asif Atick
 
Mvc
MvcMvc
Mvc
abhigad
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
Fajar Baskoro
 
Basics of asp.net mvc
Basics of asp.net mvc Basics of asp.net mvc
Basics of asp.net mvc
Micky S
 
Php.Mvc Presentation
Php.Mvc PresentationPhp.Mvc Presentation
Php.Mvc Presentation
Niranjan Vaishnav
 
Model view controller (mvc)
Model view controller (mvc)Model view controller (mvc)
Model view controller (mvc)
M Ahsan Khan
 
JSF 2.3: Integration with Front-End Frameworks
JSF 2.3: Integration with Front-End FrameworksJSF 2.3: Integration with Front-End Frameworks
JSF 2.3: Integration with Front-End Frameworks
Ian Hlavats
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
Ashton Feller
 
Intro ASP MVC
Intro ASP MVCIntro ASP MVC
Intro ASP MVC
KrishnaPPatel
 
Just a View: An Introduction To Model-View-Controller Pattern
Just a View:  An Introduction To Model-View-Controller PatternJust a View:  An Introduction To Model-View-Controller Pattern
Just a View: An Introduction To Model-View-Controller Pattern
Aaron Nordyke
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Mvc fundamental
Mvc fundamentalMvc fundamental
Mvc fundamental
Nguyễn Thành Phát
 
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
ravindraquicsolv
 
Ppt of Basic MVC Structure
Ppt of Basic MVC StructurePpt of Basic MVC Structure
Ppt of Basic MVC Structure
Dipika Wadhvani
 
Model View Controller (MVC)
Model View Controller (MVC)Model View Controller (MVC)
Model View Controller (MVC)
Javier Antonio Humarán Peñuñuri
 
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Rishu Mehra
 
MVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,MobileMVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,Mobile
naral
 
Basics of asp.net mvc
Basics of asp.net mvc Basics of asp.net mvc
Basics of asp.net mvc
Micky S
 
Model view controller (mvc)
Model view controller (mvc)Model view controller (mvc)
Model view controller (mvc)
M Ahsan Khan
 
JSF 2.3: Integration with Front-End Frameworks
JSF 2.3: Integration with Front-End FrameworksJSF 2.3: Integration with Front-End Frameworks
JSF 2.3: Integration with Front-End Frameworks
Ian Hlavats
 
Just a View: An Introduction To Model-View-Controller Pattern
Just a View:  An Introduction To Model-View-Controller PatternJust a View:  An Introduction To Model-View-Controller Pattern
Just a View: An Introduction To Model-View-Controller Pattern
Aaron Nordyke
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
ravindraquicsolv
 
Ppt of Basic MVC Structure
Ppt of Basic MVC StructurePpt of Basic MVC Structure
Ppt of Basic MVC Structure
Dipika Wadhvani
 

Viewers also liked (18)

Buyer presentation
Buyer presentationBuyer presentation
Buyer presentation
Beth Larson
 
Lutein plus
Lutein plusLutein plus
Lutein plus
Zoran Stojcevski
 
Web search-metrics-tutorial-www2010-section-6of7-freshness
Web search-metrics-tutorial-www2010-section-6of7-freshnessWeb search-metrics-tutorial-www2010-section-6of7-freshness
Web search-metrics-tutorial-www2010-section-6of7-freshness
Ali Dasdan
 
如何滅除痛苦
如何滅除痛苦如何滅除痛苦
如何滅除痛苦
宏 恆
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
Ramakrishna kapa
 
Spirulina chlorella plus
Spirulina chlorella plusSpirulina chlorella plus
Spirulina chlorella plus
Zoran Stojcevski
 
20160821 a parábola do semeador
20160821 a parábola do semeador20160821 a parábola do semeador
20160821 a parábola do semeador
Flavio Brim
 
Zvit-vihovna
Zvit-vihovnaZvit-vihovna
Zvit-vihovna
tetiana1958
 
Pseudo-addiction
Pseudo-addictionPseudo-addiction
Pseudo-addiction
Paul Coelho, MD
 
Differently-abled Heroes of India; awarded by Limca book of records
Differently-abled Heroes of India; awarded by Limca book of recordsDifferently-abled Heroes of India; awarded by Limca book of records
Differently-abled Heroes of India; awarded by Limca book of records
ATUL RAJA
 
Essential skills of a teacher
Essential skills of a teacherEssential skills of a teacher
Essential skills of a teacher
Tin Arevalo
 
Harvard Business School: Why Companies Fail and How Their Founders Can Bounce...
Harvard Business School: Why Companies Fail and How Their Founders Can Bounce...Harvard Business School: Why Companies Fail and How Their Founders Can Bounce...
Harvard Business School: Why Companies Fail and How Their Founders Can Bounce...
ATUL RAJA
 
Journalism: Guidelines and Steps in Page Designing
Journalism: Guidelines and Steps in Page Designing Journalism: Guidelines and Steps in Page Designing
Journalism: Guidelines and Steps in Page Designing
Jamaica Olazo
 
MATERI AQIDAH Mengurai Sombong
MATERI AQIDAH Mengurai SombongMATERI AQIDAH Mengurai Sombong
MATERI AQIDAH Mengurai Sombong
Anas Wibowo
 
successful entrepreneurs of flipkart {sachin and binny bansal}
successful entrepreneurs of flipkart {sachin and binny bansal} successful entrepreneurs of flipkart {sachin and binny bansal}
successful entrepreneurs of flipkart {sachin and binny bansal}
Yogesh Gokule
 
leanIX - Networking Event Hamburg 22.2.2013
leanIX - Networking Event Hamburg 22.2.2013leanIX - Networking Event Hamburg 22.2.2013
leanIX - Networking Event Hamburg 22.2.2013
LeanIX GmbH
 
Buyer presentation
Buyer presentationBuyer presentation
Buyer presentation
Beth Larson
 
Web search-metrics-tutorial-www2010-section-6of7-freshness
Web search-metrics-tutorial-www2010-section-6of7-freshnessWeb search-metrics-tutorial-www2010-section-6of7-freshness
Web search-metrics-tutorial-www2010-section-6of7-freshness
Ali Dasdan
 
如何滅除痛苦
如何滅除痛苦如何滅除痛苦
如何滅除痛苦
宏 恆
 
20160821 a parábola do semeador
20160821 a parábola do semeador20160821 a parábola do semeador
20160821 a parábola do semeador
Flavio Brim
 
Differently-abled Heroes of India; awarded by Limca book of records
Differently-abled Heroes of India; awarded by Limca book of recordsDifferently-abled Heroes of India; awarded by Limca book of records
Differently-abled Heroes of India; awarded by Limca book of records
ATUL RAJA
 
Essential skills of a teacher
Essential skills of a teacherEssential skills of a teacher
Essential skills of a teacher
Tin Arevalo
 
Harvard Business School: Why Companies Fail and How Their Founders Can Bounce...
Harvard Business School: Why Companies Fail and How Their Founders Can Bounce...Harvard Business School: Why Companies Fail and How Their Founders Can Bounce...
Harvard Business School: Why Companies Fail and How Their Founders Can Bounce...
ATUL RAJA
 
Journalism: Guidelines and Steps in Page Designing
Journalism: Guidelines and Steps in Page Designing Journalism: Guidelines and Steps in Page Designing
Journalism: Guidelines and Steps in Page Designing
Jamaica Olazo
 
MATERI AQIDAH Mengurai Sombong
MATERI AQIDAH Mengurai SombongMATERI AQIDAH Mengurai Sombong
MATERI AQIDAH Mengurai Sombong
Anas Wibowo
 
successful entrepreneurs of flipkart {sachin and binny bansal}
successful entrepreneurs of flipkart {sachin and binny bansal} successful entrepreneurs of flipkart {sachin and binny bansal}
successful entrepreneurs of flipkart {sachin and binny bansal}
Yogesh Gokule
 
leanIX - Networking Event Hamburg 22.2.2013
leanIX - Networking Event Hamburg 22.2.2013leanIX - Networking Event Hamburg 22.2.2013
leanIX - Networking Event Hamburg 22.2.2013
LeanIX GmbH
 
Ad

Similar to Jsf 2 (20)

Jsf
JsfJsf
Jsf
Esraa Yaseen
 
Jsf presentation
Jsf presentationJsf presentation
Jsf presentation
Ashish Gupta
 
JSF basics
JSF basicsJSF basics
JSF basics
airbo
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - Basics
BG Java EE Course
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
Hamid Ghorbani
 
Java server faces
Java server facesJava server faces
Java server faces
Fábio Santos
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
s4al_com
 
Design patterns
Design patternsDesign patterns
Design patterns
revamptechnologies
 
JSF.pptx
JSF.pptxJSF.pptx
JSF.pptx
ubaidullah75790
 
Vishnu(java)
Vishnu(java)Vishnu(java)
Vishnu(java)
venkata vishnu
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
tola99
 
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
 
Jsfsunum
JsfsunumJsfsunum
Jsfsunum
Frank Rodriguez
 
AK 4 JSF
AK 4 JSFAK 4 JSF
AK 4 JSF
gauravashq
 
AK 5 JSF 21 july 2008
AK 5 JSF   21 july 2008AK 5 JSF   21 july 2008
AK 5 JSF 21 july 2008
gauravashq
 
Introduction to jsf2
Introduction to jsf2Introduction to jsf2
Introduction to jsf2
Rajiv Gupta
 
Building a Web-bridge for JADE agents
Building a Web-bridge for JADE agentsBuilding a Web-bridge for JADE agents
Building a Web-bridge for JADE agents
infopapers
 
Jsfsunum
JsfsunumJsfsunum
Jsfsunum
Manav Prasad
 
Jsf
JsfJsf
Jsf
Shaharyar khan
 
Struts natraj - satya
Struts   natraj - satyaStruts   natraj - satya
Struts natraj - satya
Satya Johnny
 
Ad

More from Ramakrishna kapa (20)

Load balancer in mule
Load balancer in muleLoad balancer in mule
Load balancer in mule
Ramakrishna kapa
 
Anypoint connectors
Anypoint connectorsAnypoint connectors
Anypoint connectors
Ramakrishna kapa
 
Batch processing
Batch processingBatch processing
Batch processing
Ramakrishna kapa
 
Msmq connectivity
Msmq connectivityMsmq connectivity
Msmq connectivity
Ramakrishna kapa
 
Scopes in mule
Scopes in muleScopes in mule
Scopes in mule
Ramakrishna kapa
 
Data weave more operations
Data weave more operationsData weave more operations
Data weave more operations
Ramakrishna kapa
 
Basic math operations using dataweave
Basic math operations using dataweaveBasic math operations using dataweave
Basic math operations using dataweave
Ramakrishna kapa
 
Dataweave types operators
Dataweave types operatorsDataweave types operators
Dataweave types operators
Ramakrishna kapa
 
Operators in mule dataweave
Operators in mule dataweaveOperators in mule dataweave
Operators in mule dataweave
Ramakrishna kapa
 
Data weave in mule
Data weave in muleData weave in mule
Data weave in mule
Ramakrishna kapa
 
Servicenow connector
Servicenow connectorServicenow connector
Servicenow connector
Ramakrishna kapa
 
Introduction to testing mule
Introduction to testing muleIntroduction to testing mule
Introduction to testing mule
Ramakrishna kapa
 
Choice flow control
Choice flow controlChoice flow control
Choice flow control
Ramakrishna kapa
 
Message enricher example
Message enricher exampleMessage enricher example
Message enricher example
Ramakrishna kapa
 
Mule exception strategies
Mule exception strategiesMule exception strategies
Mule exception strategies
Ramakrishna kapa
 
Anypoint connector basics
Anypoint connector basicsAnypoint connector basics
Anypoint connector basics
Ramakrishna kapa
 
Mule global elements
Mule global elementsMule global elements
Mule global elements
Ramakrishna kapa
 
Mule message structure and varibles scopes
Mule message structure and varibles scopesMule message structure and varibles scopes
Mule message structure and varibles scopes
Ramakrishna kapa
 
How to create an api in mule
How to create an api in muleHow to create an api in mule
How to create an api in mule
Ramakrishna kapa
 
Log4j is a reliable, fast and flexible
Log4j is a reliable, fast and flexibleLog4j is a reliable, fast and flexible
Log4j is a reliable, fast and flexible
Ramakrishna kapa
 

Recently uploaded (20)

Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 

Jsf 2

  • 2.  JSF 2 Hello World using Maven  Java Server Faces (JSF) is a standard Java framework for building user interfaces for Java Web applications. It combines an MVC design approach with a standard component based UI development framework.  In this tutorial, we will create our first JSF 2 application using Maven. We will have a web page with a text box and a submit button, so when the user types a value inside the text field and click the button, he will be forwarded to another page that will display the submitted text field value.
  • 3.  JavaServer Faces (JSF) is a Java-based web application framework intended to simplify development integration of web-based user interfaces. JavaServer Faces is a standardized display technology which was formalized in a specification through the Java Community Process.
  • 4.  JSF technology is a framework for developing, building server side User Interface Components and using them in a web application.JSF technology is based on the Model View Controller (MVC) architecture for separating logic from presentation.  What is MVC Design Pattern?  MVC design pattern designs an application using three separate modules:  Module Description  Model Carries Data and login  View Shows User Interface  ControllerHandles processing of an application.
  • 5.  JSF Architecture  A JSF application is similar to any other Java technology-based web application; it runs in a Java servlet container, and contains  JavaBeans components as models containing application-specific functionality and data  A custom tag library for representing event handlers and validators  A custom tag library for rendering UI components  UI components represented as stateful objects on the server  Server-side helper classes  Validators, event handlers, and navigation handlers  Application configuration resource file for configuring application resources
  • 6.  JSF application lifecycle consist of six phases which are as follows  Restore view phase  Apply request values phase; process events  Process validations phase; process events  Update model values phase; process events  Invoke application phase; process events  Render response phase  JSF begins the restore view phase as soon as a link or a button is clicked and JSF receives a request.  The JSF builds the view, wires event handlers and validators to UI components and saves the view in the FacesContext instance. The FacesContext instance will now contains all the information required to process a request.
  • 8.  File : index.xhtml  <?xml version="1.0" encoding="UTF-8"?>  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  <html xmlns="http://www.w3.org/1999/xhtml"  xmlns:h="http://java.sun.com/jsf/html">  <h:body>  <h1>JSF2-InputText-Example</h1>  <h:form>  Name: <h:inputText value="#{user.name}" />  <h:commandButton action="welcome" value="Display my name" />  </h:form>  </h:body>  </html>
  • 9.  File : welcome.xhtml  <?xml version="1.0" encoding="UTF-8"?>  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  <html xmlns="http://www.w3.org/1999/xhtml"  xmlns:h="http://java.sun.com/jsf/html">   <h:body>  <h3>  Welcome <h:outputText value="#{user.name}" />!  </h3>  </h:body>  </html>
  • 10.  import javax.faces.bean.ManagedBean;   @ManagedBean  public class User {   private String name;   public String getName() {  return name;  }   public void setName(String name) {  this.name = name;  }  }
  • 11.  Create a JSF page  Create a page home.xhtml under webapp folder. Update the code of home.xhtml as shown below.  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd">  <html xmlns="http://www.w3.org/1999/xhtml">  <head>  <title>JSF Tutorial!</title>  </head>  <body>  #{helloWorld.getMessage()}  </body>  </html>