SlideShare una empresa de Scribd logo
1 de 25
Descargar para leer sin conexión
Java Server Faces 2.2	

PrimeFaces 4.0	

Servlet 3.0	

Maven
Java Server Faces
java web
Mario Jorge Pereira
14

20

13

20

12

20

11

20

10

20

09

20

08

20

07

20

06

20

05

20

04

20

03

20

02

20
Agenda
• Maven	

• Servlet 3.0	

• Java Server Faces - JSF 2.2	

• PrimeFaces - Prime 4.0
File > New > Other…
Skip archetype selection
br.com.mariojp.labjsf
Project > Properties > Project Facets
Runtime

são
Ver
et e
Fac
<project 	
xmlns="http://maven.apache.org/POM/4.0.0" 	
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"	
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">	
	 <modelVersion>4.0.0</modelVersion>	
	 <groupId>br.com.mariojp</groupId>	
	 <artifactId>labjsf</artifactId>	
	 <version>0.0.1-SNAPSHOT</version>	
	 <name>labjsf</name>	
	 <packaging>war</packaging>	
</project>

pom.xml
adicionando jsf 2.2 e servlet 3.0

<project ... >	
...	
	 <dependencies>	
	 	 <dependency>	
	 	 	 <groupId>com.sun.faces</groupId>	
	 	 	 <artifactId>jsf-api</artifactId>	
	 	 	 <version>2.2.2</version>	
	 	 </dependency>	
	 	 <dependency>	
	 	 	 <groupId>com.sun.faces</groupId>	
	 	 	 <artifactId>jsf-impl</artifactId>	
	 	 	 <version>2.2.2</version>	
	 	 </dependency>	
	 	 <dependency>	
	 	 	 <groupId>javax.servlet</groupId>	
	 	 	 <artifactId>javax.servlet-api</artifactId>	
	 	 	 <version>3.0.1</version>	
	 	 </dependency>	
	 </dependencies>	
</project>

pom.xml
adicionando commons-fileupload

<project ... >	
...	
	 <dependencies>	
...	
	 	 <dependency>	
	 	 	 <groupId>commons-fileupload</groupId>	
	 	 	 <artifactId>commons-fileupload</artifactId>	
	 	 	 <version>1.3</version>	
	 	 </dependency>	
	 </dependencies>	
</project>

pom.xml
adicionando primefaces

<project ... >	
...	
	 <dependencies>	
...	
	 	 <dependency>	
	 	 	 <groupId>org.primefaces.themes</groupId>	
	 	 	 <artifactId>all-themes</artifactId>	
	 	 	 <version>1.0.10</version>	
	 	 </dependency>	
	 	 <dependency>	
	 	 	 <groupId>org.primefaces</groupId>	
	 	 	 <artifactId>primefaces</artifactId>	
	 	 	 <version>4.0</version>	
	 	 </dependency>	
	 <repositories>	
	 	 <repository>	
	 	 	 <id>prime-repo</id>	
	 	 	 <name>PrimeFaces Maven Repository</name>	
	 	 	 <url>http://repository.primefaces.org</url>	
	 	 	 <layout>default</layout>	
	 	 </repository>	
	 </repositories>	
</project>

pom.xml
Mapeando o Servlet do JSF
<?xml version="1.0" encoding="UTF-8"?>	
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"	
	 xmlns="http://java.sun.com/xml/ns/javaee"	
	 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 	
	 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"	
	 version="3.0">	
<display-name>labjsf</display-name>	
<servlet>	
<servlet-name>Faces Servlet</servlet-name>	
<servlet-class>javax.faces.webapp.FacesServlet</servletclass>	
<load-on-startup>1</load-on-startup>	
</servlet>	
<servlet-mapping>	
<servlet-name>Faces Servlet</servlet-name>	
<url-pattern>*.jsf</url-pattern>	
</servlet-mapping>	
... 	
</web-app>

web.xml
Outras configurações
<?xml version="1.0" encoding="UTF-8"?>	
<web-app ...>	
...	
	<context-param>	
	 	 <param-name>primefaces.THEME</param-name>	
	 	 <param-value>bootstrap</param-value>	
	 </context-param>	
	 	
	 <welcome-file-list>	
	 	 <welcome-file>index.jsf</welcome-file>	
	 </welcome-file-list>	
!

	 <session-config>	
	 	 <session-timeout>30</session-timeout>	
	 </session-config>	
</web-app>

web.xml
<?xml version='1.0' encoding='UTF-8' ?>	
<!DOCTYPE html >	
<html xmlns=“http://www.w3.org/1999/xhtml”	
xmlns:ui=“http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"	
xmlns:f=“http://java.sun.com/jsf/core" >	
<f:view locale="en">	
	 <h:head>	
	 	 <title>JSF</title>	
	 	 <h:outputScript library="javax.faces" name="jsf.js" target="head" />	
	 </h:head>	
	 <h:body>	
	 	 <h4>JSF</h4>	
	 	 <h:form id="jsfForm">	
	 	 	 <h:inputText id="nome" value="#{mainController.nome}" />	
	 	 	 <h:commandButton value="Exibir">	
	 	 	 	 <f:ajax execute="nome" render=":jsfForm:nameGroup" />	
	 	 	 </h:commandButton>	
	 	 	 <br />	
	 	 	 <h:panelGroup id="nameGroup">	
	 	 	 	 <h:outputText value="Oi! #{mainController.nome}!!"	
	 	 	 	 	 rendered="#{not empty mainController.nome}" />	
	 	 	 </h:panelGroup>	
	 	 </h:form>	

!
	 </h:body>	
</f:view>	
</html>

index.xhtml
@ManagedBean	
@ViewScoped	
public class MainController implements Serializable {	
!

	 private String nome;	
!
!

	 public String getNome() {	
	 	 return nome;	
	 }	
!

	 public void setNome(String nome) {	
	 	 this.nome = nome;	
	 }	
!

}

br.com.mariojp.view.MainController.java
<?xml version='1.0' encoding='UTF-8' ?>	
<!DOCTYPE html >	
<html xmlns="http://www.w3.org/1999/xhtml"	
	 xmlns:ui="http://java.sun.com/jsf/facelets"	
	 xmlns:h="http://java.sun.com/jsf/html"	
	 xmlns:f="http://java.sun.com/jsf/core"	
	 xmlns:p="http://primefaces.org/ui">	
<f:view locale="en">	
	 <h:head>	
	 	 <title>PrimeFaces</title>	
	 	 <h:outputScript library="javax.faces" name="jsf.js" target="head" />	
	 </h:head>	
	 <h:body>	
	 	 <h4>PrimeFaces</h4>	
	 	 <h:form id="jsfForm">	
	 	 	 <p:inputText id="nome" value="#{mainController.nome}" >	
	 	 	 	 <p:ajax event="keyup" process="@this" update=":jsfForm:nameGroup" />	
	 	 	 </p:inputText>	
	 	 	 <br />	
	 	 	 <h:panelGroup id="nameGroup">	
	 	 	 	 <h:outputText value="OI! #{mainController.nome}!!"	
	 	 	 	 	 rendered="#{not empty mainController.nome}" />	
	 	 	 </h:panelGroup>	
	 	 </h:form>	
	 </h:body>	
</f:view>	
</html>	

index2.xhtml
@ManagedBean	
@SessionScoped	
public class LoginController implements Serializable

{	

!
	
	
	

private static final long serialVersionUID = 1L;	
private String usuario;	
private String senha;	

!
	
	
	

public String getUsuario() {	
	 return usuario;	
}	

!
	
	
	

public void setUsuario(String usuario) {	
	 this.usuario = usuario;	
}	

!
	
	
	

public String getSenha() {	
	 return senha;	
}	

!
	
	
	

public void setSenha(String senha) {	
	 this.senha = senha;	
}	

!
	
	
	

!
}	

public String autenticar() {
	 return "home"; 	
} 	

	

LoginController.java
<?xml version='1.0' encoding='UTF-8' ?>	
<!DOCTYPE html >	
<html xmlns="http://www.w3.org/1999/xhtml"	
	
xmlns:ui="http://java.sun.com/jsf/facelets"	
	
xmlns:h="http://java.sun.com/jsf/html"	
	
xmlns:f="http://java.sun.com/jsf/core"	
	
xmlns:p="http://primefaces.org/ui">	
<f:view locale="en">	
	
<h:head>	
	
	
<title>Login</title>	
	
	
<h:outputScript library="javax.faces" name="jsf.js" target="head" />	
	
</h:head>	
	
<h:body>	
	
	
<h4>PrimeFaces</h4>	 	
	
	
	
<h:form id="jsfForm">	
	
	
	
<p:panel id="panel" header="Login">	
	
	
	
	
<h:panelGrid columns="3">	
	
	
	
	
	
<h:outputLabel for="usuario" value="Usuario: *" />	
	
	
	
	
	
<p:inputText id="usuario" value=“#{loginController.usuario}" required="true"
label="Usuario">	
	
	
	
	
	
	
<f:validateLength minimum="2" />	
	
	
	
	
	
</p:inputText>	
	
	
	
	
	
<p:message for="usuario" />	
	
	
	
	
	
<h:outputLabel for="senha" value="Senha: *" />	
	
	
	
	
	
<p:password id="senha" value="#{loginController.senha}"	
	
	
required="true" label="Senha">	
	
	
	
	
	
</p:password>	
	
	
	
	
	
<p:message for="senha" />	
	
	
	
	
</h:panelGrid>	
	
	
	
</p:panel>	
	
	
	
<p:commandButton value="Enviar" id="ajax" update="panel"	
	
	
	
	
action="#{loginController.autenticar}" />	
	
	
</h:form>	
	
</h:body>	
</f:view>	
</html>

t
h

l
m

lo

.x
in
g
<?xml version='1.0' encoding='UTF-8' ?>	
<!DOCTYPE html >	
<html xmlns="http://www.w3.org/1999/xhtml"	
	 xmlns:ui="http://java.sun.com/jsf/facelets"	
	 xmlns:h="http://java.sun.com/jsf/html"	
	 xmlns:f="http://java.sun.com/jsf/core"	
	 xmlns:p="http://primefaces.org/ui">	
<f:view locale="en">	
	 <h:head>	
	 	 <title>Login</title>	
	 	 <h:outputScript library="javax.faces" name="jsf.js" target="head"
/>	
	 </h:head>	
	 <h:body>	
	 	 <h4>PrimeFaces</h4>	
	 	 <h:form id="jsfForm">	
	 	 	 <h:outputLabel value="#{loginController.usuario}" />	
	 	 </h:form>	
	 </h:body>	
</f:view>	
</html>

m
o
h

.x
e

l
tm
h
Java Server Faces
Esta obra está licenciada sob a licença Creative Commons
Atribuição-CompartilhaIgual 3.0 Não Adaptada. Para ver uma cópia
desta licença, visite http://creativecommons.org/licenses/by-sa/3.0/.
Java web
Mario Jorge Pereira
Como me encontrar?
http://www.mariojp.com.br
twitter.com/@mariojp
mariojp@gmail.com

Más contenido relacionado

La actualidad más candente

Jsp/Servlet
Jsp/ServletJsp/Servlet
Jsp/ServletSunil OS
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)Talha Ocakçı
 
JSF Component Behaviors
JSF Component BehaviorsJSF Component Behaviors
JSF Component BehaviorsAndy Schwartz
 
Resthub framework presentation
Resthub framework presentationResthub framework presentation
Resthub framework presentationSébastien Deleuze
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jspAnkit Minocha
 
JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011Arun Gupta
 
JavaFX – 10 things I love about you
JavaFX – 10 things I love about youJavaFX – 10 things I love about you
JavaFX – 10 things I love about youAlexander Casall
 
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...탑크리에듀(구로디지털단지역3번출구 2분거리)
 
Html servlet example
Html   servlet exampleHtml   servlet example
Html servlet examplervpprash
 
Spring Framework - Web Flow
Spring Framework - Web FlowSpring Framework - Web Flow
Spring Framework - Web FlowDzmitry Naskou
 
A Complete Tour of JSF 2
A Complete Tour of JSF 2A Complete Tour of JSF 2
A Complete Tour of JSF 2Jim Driscoll
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriverRajathi-QA
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOPDzmitry Naskou
 
Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course JavaEE Trainers
 

La actualidad más candente (20)

Jsp/Servlet
Jsp/ServletJsp/Servlet
Jsp/Servlet
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)
 
JSF Component Behaviors
JSF Component BehaviorsJSF Component Behaviors
JSF Component Behaviors
 
Resthub framework presentation
Resthub framework presentationResthub framework presentation
Resthub framework presentation
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 
Jsp element
Jsp elementJsp element
Jsp element
 
JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011
 
Resthub lyonjug
Resthub lyonjugResthub lyonjug
Resthub lyonjug
 
JavaFX – 10 things I love about you
JavaFX – 10 things I love about youJavaFX – 10 things I love about you
JavaFX – 10 things I love about you
 
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
 
Html servlet example
Html   servlet exampleHtml   servlet example
Html servlet example
 
Tomcat + other things
Tomcat + other thingsTomcat + other things
Tomcat + other things
 
Spring Framework - Web Flow
Spring Framework - Web FlowSpring Framework - Web Flow
Spring Framework - Web Flow
 
Wt unit 3
Wt unit 3 Wt unit 3
Wt unit 3
 
A Complete Tour of JSF 2
A Complete Tour of JSF 2A Complete Tour of JSF 2
A Complete Tour of JSF 2
 
Cis 274 intro
Cis 274   introCis 274   intro
Cis 274 intro
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
Implicit object.pptx
Implicit object.pptxImplicit object.pptx
Implicit object.pptx
 
Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course
 

Similar a Java Server Faces

JavaDo#09 Spring boot入門ハンズオン
JavaDo#09 Spring boot入門ハンズオンJavaDo#09 Spring boot入門ハンズオン
JavaDo#09 Spring boot入門ハンズオンharuki ueno
 
Ajax, JSF, Facelets, Eclipse & Maven tutorials
Ajax, JSF, Facelets, Eclipse & Maven tutorialsAjax, JSF, Facelets, Eclipse & Maven tutorials
Ajax, JSF, Facelets, Eclipse & Maven tutorialsRaghavan Mohan
 
Pom configuration java xml
Pom configuration java xmlPom configuration java xml
Pom configuration java xmlakmini
 
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Arun Gupta
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction SheetvodQA
 
Spring Boot and JHipster
Spring Boot and JHipsterSpring Boot and JHipster
Spring Boot and JHipsterEueung Mulyana
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemAndres Almiray
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overviewYehuda Katz
 
Spring into rails
Spring into railsSpring into rails
Spring into railsHiro Asari
 
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Arun Gupta
 
Training in Android with Maven
Training in Android with MavenTraining in Android with Maven
Training in Android with MavenArcadian Learning
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the FinishYehuda Katz
 

Similar a Java Server Faces (20)

JavaDo#09 Spring boot入門ハンズオン
JavaDo#09 Spring boot入門ハンズオンJavaDo#09 Spring boot入門ハンズオン
JavaDo#09 Spring boot入門ハンズオン
 
Ajax, JSF, Facelets, Eclipse & Maven tutorials
Ajax, JSF, Facelets, Eclipse & Maven tutorialsAjax, JSF, Facelets, Eclipse & Maven tutorials
Ajax, JSF, Facelets, Eclipse & Maven tutorials
 
Jsf
JsfJsf
Jsf
 
Pom configuration java xml
Pom configuration java xmlPom configuration java xml
Pom configuration java xml
 
Pom
PomPom
Pom
 
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
 
Taking your Web App for a walk
Taking your Web App for a walkTaking your Web App for a walk
Taking your Web App for a walk
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction Sheet
 
Spring Boot and JHipster
Spring Boot and JHipsterSpring Boot and JHipster
Spring Boot and JHipster
 
Symfony2 revealed
Symfony2 revealedSymfony2 revealed
Symfony2 revealed
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
 
Spring into rails
Spring into railsSpring into rails
Spring into rails
 
JAX-WS Basics
JAX-WS BasicsJAX-WS Basics
JAX-WS Basics
 
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
 
How to connect redis and mule esb using spring data redis module
How to connect redis and mule esb using spring data redis moduleHow to connect redis and mule esb using spring data redis module
How to connect redis and mule esb using spring data redis module
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Maven in Mule
Maven in MuleMaven in Mule
Maven in Mule
 
Training in Android with Maven
Training in Android with MavenTraining in Android with Maven
Training in Android with Maven
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
 

Más de Mario Jorge Pereira (20)

Labs Jogos Java
Labs Jogos JavaLabs Jogos Java
Labs Jogos Java
 
Java www
Java wwwJava www
Java www
 
Html
HtmlHtml
Html
 
HTTP
HTTPHTTP
HTTP
 
Lógica de Programação e Algoritmos
Lógica de Programação e AlgoritmosLógica de Programação e Algoritmos
Lógica de Programação e Algoritmos
 
Guia rapido java v2
Guia rapido java v2Guia rapido java v2
Guia rapido java v2
 
Guia Rápido de Referência Java
Guia Rápido de Referência JavaGuia Rápido de Referência Java
Guia Rápido de Referência Java
 
Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015 Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015
 
Java Nuvem Appengine
Java Nuvem AppengineJava Nuvem Appengine
Java Nuvem Appengine
 
Mini curso Android
Mini curso AndroidMini curso Android
Mini curso Android
 
Minicurso Android
Minicurso AndroidMinicurso Android
Minicurso Android
 
Android, por onde começar?
Android, por onde começar?Android, por onde começar?
Android, por onde começar?
 
Hands-On Java web passando por Servlets, JSP, JSTL, JDBC, Hibernate, DAO, MV...
Hands-On Java web passando por  Servlets, JSP, JSTL, JDBC, Hibernate, DAO, MV...Hands-On Java web passando por  Servlets, JSP, JSTL, JDBC, Hibernate, DAO, MV...
Hands-On Java web passando por Servlets, JSP, JSTL, JDBC, Hibernate, DAO, MV...
 
Android e Cloud Computing
Android e Cloud ComputingAndroid e Cloud Computing
Android e Cloud Computing
 
Threads
ThreadsThreads
Threads
 
RMI (Remote Method Invocation)
RMI (Remote Method Invocation) RMI (Remote Method Invocation)
RMI (Remote Method Invocation)
 
Socket
SocketSocket
Socket
 
Java e Cloud Computing
Java e Cloud ComputingJava e Cloud Computing
Java e Cloud Computing
 
GUI - Eventos
GUI - EventosGUI - Eventos
GUI - Eventos
 
GUI Aplicações Gráficas
GUI Aplicações Gráficas GUI Aplicações Gráficas
GUI Aplicações Gráficas
 

Último

P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfP4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfYu Kanazawa / Osaka University
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17Celine George
 
How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesCeline George
 
Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.EnglishCEIPdeSigeiro
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxraviapr7
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfTechSoup
 
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxPISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxEduSkills OECD
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxiammrhaywood
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfMohonDas
 
How to Make a Field read-only in Odoo 17
How to Make a Field read-only in Odoo 17How to Make a Field read-only in Odoo 17
How to Make a Field read-only in Odoo 17Celine George
 
Practical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxPractical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxKatherine Villaluna
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational PhilosophyShuvankar Madhu
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICESayali Powar
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...Nguyen Thanh Tu Collection
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationMJDuyan
 
UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024UKCGE
 
5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...CaraSkikne1
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice documentXsasf Sfdfasd
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxAditiChauhan701637
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxDr. Santhosh Kumar. N
 

Último (20)

P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfP4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17
 
How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 Sales
 
Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptx
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
 
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxPISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdf
 
How to Make a Field read-only in Odoo 17
How to Make a Field read-only in Odoo 17How to Make a Field read-only in Odoo 17
How to Make a Field read-only in Odoo 17
 
Practical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxPractical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptx
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational Philosophy
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICE
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive Education
 
UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024
 
5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice document
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptx
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptx
 

Java Server Faces

  • 1. Java Server Faces 2.2 PrimeFaces 4.0 Servlet 3.0 Maven
  • 5. Agenda • Maven • Servlet 3.0 • Java Server Faces - JSF 2.2 • PrimeFaces - Prime 4.0
  • 6. File > New > Other…
  • 9. Project > Properties > Project Facets
  • 11. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>br.com.mariojp</groupId> <artifactId>labjsf</artifactId> <version>0.0.1-SNAPSHOT</version> <name>labjsf</name> <packaging>war</packaging> </project> pom.xml
  • 12. adicionando jsf 2.2 e servlet 3.0 <project ... > ... <dependencies> <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-api</artifactId> <version>2.2.2</version> </dependency> <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-impl</artifactId> <version>2.2.2</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> </dependency> </dependencies> </project> pom.xml
  • 13. adicionando commons-fileupload <project ... > ... <dependencies> ... <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3</version> </dependency> </dependencies> </project> pom.xml
  • 14. adicionando primefaces <project ... > ... <dependencies> ... <dependency> <groupId>org.primefaces.themes</groupId> <artifactId>all-themes</artifactId> <version>1.0.10</version> </dependency> <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>4.0</version> </dependency> <repositories> <repository> <id>prime-repo</id> <name>PrimeFaces Maven Repository</name> <url>http://repository.primefaces.org</url> <layout>default</layout> </repository> </repositories> </project> pom.xml
  • 15. Mapeando o Servlet do JSF <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <display-name>labjsf</display-name> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servletclass> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> ... </web-app> web.xml
  • 16. Outras configurações <?xml version="1.0" encoding="UTF-8"?> <web-app ...> ... <context-param> <param-name>primefaces.THEME</param-name> <param-value>bootstrap</param-value> </context-param> <welcome-file-list> <welcome-file>index.jsf</welcome-file> </welcome-file-list> ! <session-config> <session-timeout>30</session-timeout> </session-config> </web-app> web.xml
  • 17. <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html > <html xmlns=“http://www.w3.org/1999/xhtml” xmlns:ui=“http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f=“http://java.sun.com/jsf/core" > <f:view locale="en"> <h:head> <title>JSF</title> <h:outputScript library="javax.faces" name="jsf.js" target="head" /> </h:head> <h:body> <h4>JSF</h4> <h:form id="jsfForm"> <h:inputText id="nome" value="#{mainController.nome}" /> <h:commandButton value="Exibir"> <f:ajax execute="nome" render=":jsfForm:nameGroup" /> </h:commandButton> <br /> <h:panelGroup id="nameGroup"> <h:outputText value="Oi! #{mainController.nome}!!" rendered="#{not empty mainController.nome}" /> </h:panelGroup> </h:form> ! </h:body> </f:view> </html> index.xhtml
  • 18. @ManagedBean @ViewScoped public class MainController implements Serializable { ! private String nome; ! ! public String getNome() { return nome; } ! public void setNome(String nome) { this.nome = nome; } ! } br.com.mariojp.view.MainController.java
  • 19. <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html > <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <f:view locale="en"> <h:head> <title>PrimeFaces</title> <h:outputScript library="javax.faces" name="jsf.js" target="head" /> </h:head> <h:body> <h4>PrimeFaces</h4> <h:form id="jsfForm"> <p:inputText id="nome" value="#{mainController.nome}" > <p:ajax event="keyup" process="@this" update=":jsfForm:nameGroup" /> </p:inputText> <br /> <h:panelGroup id="nameGroup"> <h:outputText value="OI! #{mainController.nome}!!" rendered="#{not empty mainController.nome}" /> </h:panelGroup> </h:form> </h:body> </f:view> </html> index2.xhtml
  • 20. @ManagedBean @SessionScoped public class LoginController implements Serializable { ! private static final long serialVersionUID = 1L; private String usuario; private String senha; ! public String getUsuario() { return usuario; } ! public void setUsuario(String usuario) { this.usuario = usuario; } ! public String getSenha() { return senha; } ! public void setSenha(String senha) { this.senha = senha; } ! ! } public String autenticar() { return "home"; } LoginController.java
  • 21. <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html > <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <f:view locale="en"> <h:head> <title>Login</title> <h:outputScript library="javax.faces" name="jsf.js" target="head" /> </h:head> <h:body> <h4>PrimeFaces</h4> <h:form id="jsfForm"> <p:panel id="panel" header="Login"> <h:panelGrid columns="3"> <h:outputLabel for="usuario" value="Usuario: *" /> <p:inputText id="usuario" value=“#{loginController.usuario}" required="true" label="Usuario"> <f:validateLength minimum="2" /> </p:inputText> <p:message for="usuario" /> <h:outputLabel for="senha" value="Senha: *" /> <p:password id="senha" value="#{loginController.senha}" required="true" label="Senha"> </p:password> <p:message for="senha" /> </h:panelGrid> </p:panel> <p:commandButton value="Enviar" id="ajax" update="panel" action="#{loginController.autenticar}" /> </h:form> </h:body> </f:view> </html> t h l m lo .x in g
  • 22. <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html > <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <f:view locale="en"> <h:head> <title>Login</title> <h:outputScript library="javax.faces" name="jsf.js" target="head" /> </h:head> <h:body> <h4>PrimeFaces</h4> <h:form id="jsfForm"> <h:outputLabel value="#{loginController.usuario}" /> </h:form> </h:body> </f:view> </html> m o h .x e l tm h
  • 24. Esta obra está licenciada sob a licença Creative Commons Atribuição-CompartilhaIgual 3.0 Não Adaptada. Para ver uma cópia desta licença, visite http://creativecommons.org/licenses/by-sa/3.0/.
  • 25. Java web Mario Jorge Pereira Como me encontrar? http://www.mariojp.com.br twitter.com/@mariojp mariojp@gmail.com