Download as pdf or txt
Download as pdf or txt
You are on page 1of 175

!

" # $
) (
( ! * #) * #+ # , -+* ."
'
keulkeul.blogspot.com

/ 0 11 # !1 # #1 2 # 1 1$

%&' ( !
( * ! ! *" "#
+ "# * "4 4 0 #
5 # " # *6 * " " ! *" "#

( ." #
) ## * %
) ## * #$ * # *" 78 9: ;< 9::(
) ## * # / ! #=$ * #>* % 88 & <
%&(< # #0 # # #
& " " *" "#
keulkeul.blogspot.com

5 ! 0 # # # * %&' !
( " / ." " " 0 *" < 0 # *
: 0 * # 0 # 0 "# 0 4 #
#
5 00 ? @*A #0 " # # #B%&' ( ! 3
# # " $ D * * 00
*6 00 #7 % 0 * #0
*E *6 / " !" # #" * # 0 # # Fé
0 é#
% & ' #0
" # 0 * " / 0 # * # " # " / # G)
" 00 ! 69: ; 6 A
" # * 0 # # / # " # #
" # # 0 # # F * 6" # "
keulkeul.blogspot.com

# * % F # "
) * " "4 0 # # ! 0/ ." #
%&' 0 " H " # 0 " ! " / # ." *" 9: ; IJ;<
I ;< 7 ;< K %&' ( ! C
# $ %

( ## * * " "4 0 # #
%&' 0 * 0 "# " # 0 # #0 " " ,"
0 # 0 "# 0 4

&"00 * $$ # / ! # *6 $$ / !
%&' # 0 # , 69: ; IJ;< ' #/< K

E# "4 #0 "# # " # # 840 ## #


; !" !
( " & "# ## * # *" $ "

& 0 $ * #* $ #* # F "# * # #
keulkeul.blogspot.com

& 0 $ *" $ / * $ !"


;6 0 # # ! 0/ ." # 0 , %&' *6H
" # * E 0 "# # 0 * # # #*
* 00 &" % & "* ) %&' ( ! L
%

" * & "#0 00 , %&'


& "# # ! " # *"# # ." %&' # "
$ D A "

) $"# * # #
& "# # #* #$ " # $ A#0 # F "#
$ * * $$ # J ;6#
%&' " # # H # #0 " " F "

; * * # %&' 6 # 0 # "## $ " ." & " #


( ## * ! *" % & 0 & " # 0 # %&'
keulkeul.blogspot.com

( ## * $ #2 4 *6" * * <" #
*6 40 ## # !" E #< K

#* * " * ## " #
"# # *62 * K %&' ( ! M
%&' 0 "0 * # / ! #0 0 # #0 &" #
* $ * #" #0 $ %& # 0" #
%& L
+ 4# * 0 "# " # 0 # * %&'
&" $ / 0 11A #" 1A 1A # $ #
0 / 2' # / 0 11 2$ # 0 / !

;6 0 0 0 # 0 0 / # 00 !&
0 / $ " * #$ # ** # # "#
keulkeul.blogspot.com

0 A ' ( )* ++ ,
) 0 # # ! 0/ ." # - +. +-
, /
G * # 0 "# $ " # %&' ( !
H # %&' 6 # 0 # "## " # * " ." & " #<
* "4 # # , 00 O 0 " 0 0 #
" # 4 0 # 0 "* ## " $ P #
:" #1) "#
% 88 ! * " # / 0 11DDD # #
:" "4 / ? 5 00 ? / 0 11DDD * 00 ?
% 5 "* "4 / 0 11DDD A * "* "4 $ 1 " /
& * $ / 0 11A #" 1A 1A # $ #
& *" 0 A / 0 11A # $ #* A
:" % 88 / 0 11A #" 1A 1L1* #1 " 1*
keulkeul.blogspot.com

' Q / 0 11D A 1 1 D1( A #1% & ' #&0 ' .


84 0 # 0 # #
84 0 # %&' % I< 0 # # / 0 11A#$ " #
) " " %&' / 0 11DDD A#$ %&' ( ! N
0 (1 %

2 3 45 6 0 $7 ( %
" " % #%
S* " 0 ##
8* M CMC 0 ! # +& LR LR LN

4
" " T
S* " ! (" #
8* L 0 ! # +& R3 3R C
keulkeul.blogspot.com

" " 5 *U 2 *) 29 #
S* " ( 9 (
8* C MLN 0 ! # +& 3 CM 3 L L
%&' ( ! R
8 ( %

;6 $ " # " # " * # 0 ! %&( #


! , 6 * * / ! %&' #" 2J+
8 $ #" # " *" # " "

%&' #6 00" #" # / ! #0 * #


U &
keulkeul.blogspot.com

J # * # 0 # # %&'
* # # 0 ! # %&(
; # 0 # # %&' # 40 # #
"4 %&(# ! V "4 # #0 # #é# %&' ( !
9
) # " $ " * #" 0 ! %&( " # #
# # %&'
5 00 " ." $$ " " = 00 ! > #
" # *" $ "
3 *$ $ " 0 " #0 $ 6 6 ## "

C ' " * #) # * #G * #0 " #


* # *" $ "
L ( $ / $ # $! 4 0 " *
# E! # * !
keulkeul.blogspot.com

M ) # 0 ! # %&( #0 * , / ." * *
"
( ! # 0 ! # %&( " # #0 4 %&' * $ P
, *62 * * %&' ( !
2

9$ " # %&' * #" 00 % 88


0 ! $ # < $$ / # " # *6" $ "
& 0 * # " ! # *6" 0 # %&'
: $ / # " " # " ## !
;7 <'! ! # " "
6 0" $ # *" 4
0 * $0 0" # # #* # 0 # #
! $ # $$ / * # ## ! # * # # %&(
#$ # " # # # # *6" $ "
keulkeul.blogspot.com

" * # " # # # # *6" $ "


! # #" # "
' ( )* A " * " "4 0 # #
* %&' /E."
( !
9$ ) 6

## $ !" *" $ / ) 6 * $ P ,
." %&' # 0 # 0
( $ ! * 6 00 F "
+* $ # 0 0 A 4$ #D 00 ' #&
&0 $ / *" $ / * $ !"
*" 0 E A 4$ # 00 ) '+UW'+;8&
84 0 178 + '1$ # $! 4
&0 $ X 6 * 6 00 * H # "
*" 0 E A 4$ # &: :8W& G+ UW 8:9 5
keulkeul.blogspot.com

G " # 0 ## # "#
G * "0 # #$ / #I ;
*" 0 E #" $ # * I
G " # 0 ## # " "$ # * $ " $ # %&' ( ! 3
9$ ) 6

+ * ." # # A # * 00 # # ." # #< #


0 # #< # * # # #* H
# "* ! * 6 00
*" 0 E #" $ # $2 A #
G " # 0 ## # " "$ # * $ " $ #
; # 0 0 # 0 *6 *6" 00 %&'
" 0 "# " # E #* * / * # ## " # %&'
( $ 4 1$ #1
&"$$ 4 # Y A#$ " Y $ #
84 0 # 4 * 2 00
6 00 #
keulkeul.blogspot.com

/ 0 11 / # 1 2 00 1$ #1 * 4 A#0
/ 0 11 / # 1 2 00 1 * 4 A#$

4 $
99 6 = > ?
%&' ( ! C
9$ ) 6

84 0 0 " 00 7 * 20 %&'
J # * 4 0 0 "
0 $ * # %&'
...
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param> ; & ." !E # #
<servlet> " 4 %&'
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
) * , &
</servlet-mapping>
keulkeul.blogspot.com

<servlet-mapping> =' #& >


<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
...

D 4
%&' ( ! L
9$ 1 6 $ 2

Q" *" 0 ! %&( " # * # 0 # # %&' * H


! 0 & 0 0
/ 0 11 / # 1 2 00 1$ #1 * 4 A#0 00 * 0 ! * 4 A#0

5 # # X" 0 ! %&( # 00 * # #
0 ## 0 & 0 0 " " # !
/ 0 11 / # 1 2 00 1 * 4 A#0 @@@

8 0H / * # # *6 * * "4 0 ! #
%&( ." 40 * # 0 # # %&'
keulkeul.blogspot.com

& " #
J # # # " 2 # * # $ / D 4
5 / ." 0 ! %&( ." * H 0 ! # ." " #
* # 0 # # %&'
%&' ( ! M
9$ 1 6 $ 2

84 0 # * 6 E# "4 0 ! # %&(
...
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param> A " # # " 2 #
... * # $ / D 4
<securiy-constraint>
<web-resource-collection>
<web-resource-name>No-JSF-JSP-Access</web-resource-name>
<url-pattern>/welcome.jsp</url-pattern>
<url-pattern>/form1.jsp</url-pattern>
<url-pattern>/accepted.jsp</url-pattern>
<url-pattern>/refused.jsp</url-pattern>
<url-pattern>...</url-pattern>
</web-resource-collection> ; # 0 ! # %&( ." " #
<auth-constraint> * # 0 # # %&'
<description>Pas de rôles, donc pas d’accès direct</description>
keulkeul.blogspot.com

</auth-constraint>
</security-constraint>
...

2 $ 99 $
2
%&' ( !
9$ 9 ( ? =9 9$6 >

; $ / ! ! ." * 6 00 D #6 00 0
* $ " $ # $! 4
+ # 0 * # 0 78 + ' " H " ."
D 4
+ * ## #4 0 0 "4 #
# # ! #Z ! * [
# E! # * ! Z ! " [
# ## " # " # #" ,* # ## ! # Z ## ! " * [
$ !" * # Z # " " * [
$ !" * #G * # * #) #Z * [
keulkeul.blogspot.com

Z [
*6 " # # #,* # " "4 0 # # %&' Z * [
; $ / * $ !" # " $ / I ;* 0 "
5:5 ; # * * 0 # Z$ # $ ![
# %&' ( ! N
9$ 9 ( ? =9 9$6 >

; * # 0 * 6 # * # # #0 " H "
/ 0 11DDD / # 1 A#$1$ # $! /

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE faces-config PUBLIC


"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config>
<navigation-rule>
...
5 # 0 * $
</navigation-rule>
* 6 00 %&'
<managed-bean>
...
keulkeul.blogspot.com

</managed-bean>
</faces-config>

+-
( '
%&' ( ! R
9$ 2

; # 0 # # %&' # " # # * # # 0 ! # %&( "


2 * # #0 # # # * * # "4 %&'
) 8 2 " ." !E # " # ;7 <'!
9: ; 0 # # %&'
5 # 0 * # # #0 # # #) 9: ;
/ 0 11A #" 1A 1A # $ #1 W 1* #1 ** #
/ 0 11DDD / # 1 A#$1A#$ !# /
( ## *6" # *6 " # # # : / D < 5' ' #
; # 0 # # %&' * H * #0 " " %&'
* 0 # Z D[
keulkeul.blogspot.com

<%@taglib uri="http://java.sun.com/jsf/core" prefix="core" %>


<%@taglib uri="http://java.sun.com/jsf/html" prefix="html" %>
...
<core:view> J # * #
0 # # %&'
... 2
</core:view>
...
<'! 2@@@
%&' ( !
9$ '

( " 40 * 0 2 " 00 78 %&'


$ "
* # # %&' 0 / " &" %&:;
$ !" $ / D 4 # # * %&'

; # #0 " H 0é # # à ’ 00 D
# ! * # é0 :
*.html, *.jsp, ...
bin

U ,
WEB-INF web.xml 6 00 jsf-api.jar
MyApp faces-config.xml
lib
keulkeul.blogspot.com

jsf-impl.jar
classes ... jstl-1.2.jar
jsf-api.jar …
jsf-impl.jar
lib
jstl-1.2.jar

conf

; , Tomcat
classes
6 00
%&' ( !
9$ '

& # # " *6 00 < $ / D 4


* H 0é é : M0 " # ##
( " # L * %&' 2' #
<web-app ...>
...
<listener>
<listener-class>
org.apache.myfaces.webapp.StartupServletContextListener
</listener-class>
</listener>
</web-app>

( " # * %&' &" D 4


<web-app ...>
...
<listener>
<listener-class>
keulkeul.blogspot.com

com.sun.faces.config.ConfigureListener
</listener-class>
</listener>
<listener>
<listener-class>
com.sun.faces.application.WebappLifecycleListener
</listener-class>
</listener>
</web-app>
%&' ( !
6 =< >

84 0 $$ / ## ! = 9 7 *> %&'
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib uri="http://java.sun.com/jsf/core" prefix="core"%>


<%@taglib uri="http://java.sun.com/jsf/html" prefix="html"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hello World avec JSF</title>
</head>
<body>
<core:view>
<h1><html:outputText value="Hello World avec JSF" /></h1><br>
La même chose avec du HTML : <h1>Hello World avec JSF</h1>
</core:view>
</body>
keulkeul.blogspot.com

</html>

D %&' A#0 *" 0 A


<
%&' ( ! 3
6 =< >

84 0 #" $$ / ## ! = 9 7 *>K
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-
app_2_4.xsd">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<security-constraint>
<display-name>Constraint1</display-name>
<web-resource-collection>
<web-resource-name>No-JSP-JSF-Page</web-resource-name>
<url-pattern>/welcomeJSF.jsp</url-pattern>
keulkeul.blogspot.com

</web-resource-collection>
<auth-constraint>
<description>Pas de rôles, donc pas d’accès direct</description>
</auth-constraint>
</security-constraint>
</web-app>

D 4 *" 0 A < %&' ( ! C


6 =< >

84 0 #" $$ / ## ! = 9 7 *>K
) #* # ." 0 ! D %&' A#0 $ ."
## " # * * # # 0 ## 0 & 0 0
keulkeul.blogspot.com

" *6" ## ! *6 " # #


%&' # 0 # #0 & 0 0
%&' ( ! L
6 =< >

84 0 #" $$ / ## ! = 9 7 *>K
) #* # ." ## " D %&' A#0 $ ."
## " # * * # # 0 ## 0 & 0 0
keulkeul.blogspot.com

" *6" ## ! *6 " 0 ! # 0 !

%&' ( ! M
6 =< >

84 0 #" $$ / ## ! = 9 7 *>K

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE faces-config PUBLIC


"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config>

</faces-config>
keulkeul.blogspot.com

$ # $!4
6 9$ *" 0 A
: <
1$ $
0 $
%&' ( !
0 ! $

00 # ."6" # " ## % #0 "


# * * #
J # " " 0" # # !"
; #0 0 # *6" # ## # " #* / * #
! III # III 0 * 0 0

;6" # * # #* # %&' 0
6 $$ / ! * # * #0 * " /
# ! * # " # *6" $ "
* * # "#
6 ## * ## ! # 0 " ! P"# 0 $ # $! 4
keulkeul.blogspot.com

0
$
6 ?
: $
%&' ( ! N
0 ! $

J ! # " * # ! 0 %&'
* * # $ / * $ !" $ # $! 4
5 $ *" * # 0 *6"
+ # #0 0 # *6"
* $$ * # #" # #* # & " #< # #
! # * %&' 6/ 0 # *6" ## 0 " E
; # ## # # # #* # 0 78 + '1 ## #
*.html, *.jsp, ...

WEB-INF web.xml, faces-config-xml


keulkeul.blogspot.com

classes Beans

lib Librairie JSF


%&' ( ! R
0 $ 9$ 9 9$6

( " " ! $ " * * # $ /


* $ !" * %&' , 6 * * # Z ! * [
: # # ## ## ,0 #
Z ! * [* $ " ." # *6 ." ." *
# 40 * # # 0 ! # %&(
Z ! * ##[ * * ## * 20
0 ! ##
Z ! * # 0 [0 # 20 * # 0 " # 0 "
< 00 < # ## < ." #
... 8 "* * #
<navigation-rule>...</navigation-rule> 0 !
keulkeul.blogspot.com

<managed-bean>
<managed-bean-name>MyBean</managed-bean-name>
<managed-bean-class>mypackage.MyFirstBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
...
$ # $!4 %&' ( ! 3
0 $ 2# 0 6 $ $ A B
J $ " %&' * H # " * # " ! "0 * $
0 # Z/ $ [ Z1/ $ [
):+ # " ." , &8;' J ; "
8:9 5 # ! ( &:

J # * 0 # # %&' 0 " # # * # $ #
Z/ 0" : 4 [ 0 " # 9: ; Z+ (J: :\(8]^: 4 ^[
Z/ 0" & [0 " # Z+ (J: :\(8]^( &&7 5^[
Z/ * " [0 " # Z+ (J: :\(8]^&J +:^[

; # Z/ * " [ " "


keulkeul.blogspot.com

." 0 *6 * ." " ## ! 0 # E! # *


! * $ #* #$ # $! 4
:
: $
%&' ( ! 3
0 $ 2# 0 6 $ $ A B

84 0 $ " %&( " # * # 0 # # %&'


<%@page contentType="text/html"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="core"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="html"%>
<html>
<head>
<title>Premier formulaire avec JSF</title>
</head>
<body>
<core:view>
<html:form>
<html:outputText value="Adresse Email " /><html:inputText/><br>
<html:outputText value="Mot de Passe " /><html:inputSecret/><br>
<html:commandButton value="Connecter" />
</html:form>
</core:view>
</body>
</html>
keulkeul.blogspot.com

$ A#0 *" 0 A
! $ 0

%&' ( ! 3
0 $ 2# 0 6 $ $ A B

; # 40 ## # !" ! # 8; # " # #0 " *


"4 # *" * # # 0 ! # %&(

J 8; 0 *6 * # 0 "4 # * # * $$ #
# 0 #* 6 00 0 ! < ." # < # ## 00

' *6" 840 ## ; !" ! %&'

#{expression}

; # 8; %&' # * $$ # * # 8; %&( ." " #


keulkeul.blogspot.com

_` 40 ## a

J 8; # " 40 ## * #" # " "


X %&' $$ " *" * 0 ! %&' ( ! 33
0 $ 2# 0 6 $ $ A B

;6 " b` 2 " a * ." , %&'


* / / " A ." 0 * 2 * ## 4
0" # ." / * ! G " / / 0 0 "

; * 6 A # * * # $ /
$ # $! 4
...
<navigation-rule>...</navigation-rule>
<managed-bean>
<managed-bean-name>MyBean</managed-bean-name>
<managed-bean-class>mypackage.MyFirstBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
keulkeul.blogspot.com

...

( ## *6 * ," A "* #
b` 2 2 A " a 0 0 " * 2 A "
* # 2 %&' ( ! 3C
0 $ 2# 0 6 $ $ A B

%&' * $ " # *6 A # 0 #" # #* # #


840 ## #; !" ! #

0 #* $ #* # #0 E #* ."H 9::(

0 " # # " # * # éé #0

# éé # *é$ #* # # #

( 0 è # *’ # * ’ 00
8 "* " "*
." # & 0 éé # *é$ * # ."H
0 2 *
keulkeul.blogspot.com

$ #) 4 # * ## ' #) 4

G D # * J+G D
840 ." " "* #
0 # # ! 0/ ." # %&' ( ! 3L
0 $ 2# 0 6 $ $ A B

84 0 A # 0 # %&' * #" %&(


<html>
<...>
<body>
<core:view>
<p><html:outputText
value="#{param.test}" /></p>
<p><html:outputText
value="#{cookie.JSESSIONID.value}" /></p>
<p><html:outputText
value="#{facesContext.externalContext.requestPathInfo}" /></p>
<p><html:outputText
value="#{facesContext.externalContext.requestServletPath}" /></p>
</core:view>
</body>
</html>
keulkeul.blogspot.com

0 A # A#0 *"
0 A ; 5

%&' ( ! 3M
0 $ 9 C 99 ( 0

J $ " ! "0 " # * 0 # #


/ " " " " "
)/ ." " *6" 0 # 0 " H # * #"
0 0 *"
( " * $ " 0 0 * #"
) 6 " #0 * , 0 0
5 $ * # / * ## ! 0 " * " "
"4 0 0 #

( " # " *6" 0 # # "


keulkeul.blogspot.com

$$ / " *6" 0 0 * #" 0 #


" # * # 8; * # 6 " " *" 0 # %&'
%&' ## " ." 0 0 *6" ,
" *6" 0 # %&' ( ! 3
0 $ 9 C 99 ( 0

84 0 ! # *6" $ " = * 0 ## >


package beanPackage;
public class RegistrationBean {

private String email = "user@host";

private String password = "";

public String getEmail() {


return email;
} !# A *"
public void setEmail(String t) { 0 A ! $ 0
this.email = t;
0 ##E* * "4 0 0 #
}
public String getPassword() { * # *$ " # ## " #
keulkeul.blogspot.com

return password;
}
public void setPassword(String t) {
this.password = t;
}
}

%&' ( ! 3N
0 $ 9 C 99 ( 0

84 0 #" ! # *6" $ " K


... 8; 0 " * ,
<core:view> 0 0
<html:form>
<html:outputText value="Adresse Email "/>
<html:inputText value="#{registrationbean.email}"/><br>

<html:outputText value="Mot de Passe "/>


<html:inputSecret value="#{registrationbean.password}"/><br>

<html:commandButton value="Connecter" />


</html:form>
</core:view> 8; 0 " * ,
</body> 0 0 0 ##D *
</html>
keulkeul.blogspot.com

$ A#0 *" 0 A
! $ 0

$$ / ! * "
*6 # *"
%&' ( ! 3R
0 $ 9 C 99 ( 0

84 0 #" ! # *6" $ " K

<faces-config>
<managed-bean>
<managed-bean-name>
+* $ " # 0 " *
registrationbean
</managed-bean-name> " * $ 0 ##
<managed-bean-class> 0 ! !#
beanpackage.RegistrationBean
</managed-bean-class>
<managed-bean-scope>
request
</managed-bean-scope>
</managed-bean>
keulkeul.blogspot.com

</faces-config>

$ # $ ! 4 *" 0 A
! $ 0
%&' ( ! C
0 $ 0

( ## *6 # 0 0 *6" * #
" H
$ / $ # $! 4
5 # $ / $ # $! 4 " # * # 8;
E# "4 A # 0 #
E# "4 " # # ! #
;6 # *6" # " , 6 " * #
Z ! * [* # # Z ! *0 0 2[
)/ ." 0 0 , # # * 0 #
Z0 0 2 [ "* #Z ! *0 0 2[
keulkeul.blogspot.com

J 0 0 0 " H * * $$ # 20 #
;# * $ " 0 0 * 20 #
0 * $ " 0 0 * 20 0 " 1 "
G " * $ " 0 0 #" " "
%&' ( ! C
0 $ 0

& 0 0 # * 20 ; # < 6 # * # "#*


0 0 # $$ " * # # Z # #[
5 # # Z # #[ * "4 $ ## , * ."
Z " ##[ 20 *6 A "* # #
Z " [ " " * # # " *6 * #

<managed-bean>
...
<managed-property>
<property-name>cities</property-name>
<list-entries>
<value-class>java.lang.String</value-class>
keulkeul.blogspot.com

<value>Poitiers</value>
<value>Limoges</value>
<value>Viroflay</value>
</list-entries>
</managed-property>
</managed-bean>

%&' ( ! C
0 $ 0

& 0 0 # * 20 0< 6 # * # "#*


0 0 # $$ " * # # Z 0 #[
5 # # Z 0 #[ # $ ## ,*
Z 2 ##[ 20 *
Z " ##[ 20 *6 A "* # 0
Z 0 2[ " " "
; # Z 0 2[ * "4 $ #
Z 2[
Z " [ " ## ,
<managed-property>
keulkeul.blogspot.com

<property-name>prices</property-name>
<map-entries>
<map-entrie>
<key>SwimmingPool High Pressure</key>
<value>250</value>
</map-entrie>
</map-entries>

%&' ( ! C3
0 $ 0

& 0 0 # * 20 G " < 6 # * " *


0 0 # $$ " * # # Z " [
<managed-bean>
...
<managed-property>
<property-name>email</property-name>
<value>user@host</value>
</managed-property>
<managed-property>
<property-name>name</property-name>
<value>your name</value>
</managed-property>
$ # $!4 *"
keulkeul.blogspot.com

<managed-property>
<property-name>adress</property-name> 0 A
<value>your adress</value> ! $ 0
</managed-property>
</managed-bean>
%&' ( ! CC
0 $ 0

84 0 # * 0 0 #* #$ # $! 4
</managed-bean>
<managed-bean>
<managed-bean-name>registrationbeanbis</managed-bean-name>
<managed-bean-class>
beanPackage.RegistrationBeanBis
</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>email</property-name>
<value>#{registrationbean.email}</value>
</managed-property> J # *6" 8; 0 "
<managed-property>
* " * $
<property-name>adress</property-name>
<value>Your Adress</value> 0 !#
keulkeul.blogspot.com

</managed-property>
</managed-bean>

$ # $!4 *" 0 A
! $ 0
%&' ( ! CL
0 $ 0

84 0 #" # * 0 0 #K
<html>
<head>
<title>Troisième formulaire JSF avec un Bean Managé ...</title>
</head>
<body>
<core:view>
<html:form>
<html:outputText value="Adresse Email "/>
<html:inputText value="#{registrationbeanbis.email}"/><br>
<html:outputText value="Adresse Postale "/>
<html:inputTextvalue="#{registrationbeanbis.adress}"/><br>
<html:commandButton value="Connecter" />
</html:form>
</core:view>
</body>
</html>
keulkeul.blogspot.com

$ 3 A#0 *" 0 A
! $ 0

%&' ( ! CM
& $
0 # 0 #
) 0E ) 0E

."H # 00 2 ( ## ( ## ( ##
' # G D ." # # 8 # G * # 8 #

0 # 0 #
) 0E ) 0E

0 # * + J0*
( ## ( ##
#0 # 00 *
' # 8 # 8 #
G " #
keulkeul.blogspot.com

8 "#* ) #
8 "#* ) #
1 "* G *
9 , #
# #% %&' ( ! C
& $

7 " ) %&' # " 6 # * # 0


# # ." 0 # 0 !

4 &7 # "#* #* ## 4 #*
."H

2 " 0 è* à * * #* é #

D # à A " *" *è # #
"# ç" # # * " # é"##
keulkeul.blogspot.com

* 4 #é é #é #* 0 ! #
é# 8 0 * *é 0 / 0 !

7 7 é *" *" * 0 !
%&' ( ! CN
: $ 9$ 9 9$6

; $ / * $ # $! 4 A " F * F "<
* * * ## " ." * H 00 #" ,
0 *6" ## !
; # ## ! # # * ## 0 # / O #* E #
J # * # Z ! " [0 " 0 #
E! # * !
; # Z$ D *[ * ." " # " X #
$$ " * * * * ; " 0 " H "
' " * # " ##
; /20 4
keulkeul.blogspot.com

( " / ." " * ## ! " 0 ! " * * #


* ." * # # Z ! # [
Z$ " [ " *" ## !
Z D *[ " * * %&' ( ! CR
: $ &

%&' 0 " / , #0 " ! !


* # 0 ! # %&'
( " # / # "# * # !" # * "4 # #* !
! # ."
! *2 ."
: $
; " * 6 " # " " * 6 " * %&(
: $ &
; " * 6 " # " " * 6 " * %&(
keulkeul.blogspot.com

8 0 " H "é 0 " !é " " / # …


." #
& " " *6 " # " H 0 ! %&( # / !
& " " " 0 ! %&( # / ! %&' ( ! L
: $ 6

84 0 * # ." , 0 *6" $ "


...
<html>
<head>
<title>Redirection Statique à partir d’un formulaire</title>
</head>
<body>
<core:view>
<html:form>
<html:outputText value="Nom : " />
<html:inputText value="#{beancontroller1.name}"/><br>
<html:outputText value="Adresse email : " />
<html:inputText value="#{beancontroller1.email}"/><br>
<html:commandButton value="Connecter" action="register"/>
</html:form>
</core:view>
</body>
</html>
keulkeul.blogspot.com

$ A#0 *" 0 A
: $

%&' ( ! L
: $ 6

84 0 #" * # ." K
...
$ # $!4
<faces-config>
<navigation-rule>
<from-view-id>/form1.jsp</from-view-id>
<navigation-case>
<from-outcome>register</from-outcome>
<to-view-id>/accepted.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="core"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="html"%>

<html>
... 0 *& 0 A#0
keulkeul.blogspot.com

<body>
*" 0 A : $
<core:view>
<h1><html:outputText value="Redirection Réussie" /></h1>
</core:view>
</body>
</html> : E $ $
2 9 +5 5 %&' ( ! L
: $ & 6

84 0 * *2 ." , 0 *6"
package beanPackage;
public class BeanController2 {

private String email = "user@host";


private String name = "";
... ) / * 0 *
* # "# *
public String loginConnect() { / # ## ! , "
if (this.email.isEmpty()) { Cette méthode" retourne
F %&'
return "Rejected"; soit « Accepted » soit
} « Rejected »
if (this.name.isEmpty()) {
return "Rejected";
}
$ (
keulkeul.blogspot.com

return "Accepted";
} 9
} 9 :
9
) A "
*" 0 A : $ %&' ( ! L3
: $ & 6

84 0 #" * *2 ." , 0 *6"


<faces-config>
<navigation-rule>
<from-view-id>form2.jsp</from-view-id>
<navigation-case>
<from-outcome>Accepted</from-outcome>
<to-view-id>/accepted.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>Rejected</from-outcome>
<to-view-id>/rejected.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>beancontroller2</managed-bean-name>
keulkeul.blogspot.com

<managed-bean-class>
beanPackage.BeanController2 $ # $ ! 4 *"
</managed-bean-class> 0 A : $
...
</faces-config>

%&' ( ! LC
: $ & 6

84 0 #" * *2 ." , 0 *6"


...
<html>
<head>
<title>Redirection Dynamique à partir d’un formulaire</title>
</head>
<body>
<core:view>
<html:form>
<html:outputText value="Nom : " />
<html:inputText value="#{beancontroller2.name}"/><br>
<html:outputText value="Adresse email : " />
<html:inputText value="#{beancontroller2.email}"/><br>
<html:commandButton value="Connecter"
action="#{beancontroller2.loginConnect}"/>
</html:form>
E# " * $ 0
</core:view>
keulkeul.blogspot.com

</body> ,
</html> / * ! )

$ A#0 *" 0 A
: $
%&' ( ! LL
: $ & 6

84 0 #" * *2 ." , 0 *6"

<%@taglib uri="http://java.sun.com/jsf/core" prefix="core"%>


<%@taglib uri="http://java.sun.com/jsf/html" prefix="html"%>

<html> 0 * A#0 *"


<head> 0 A
: $
<title>Résultat du traitement du formulaire</title>
</head>
<body>
<core:view>
<h1><html:outputText value="Connexion de : "/>
<html:outputText value="#{beancontroller2.name}" /></h1>
</core:view>
</body>
keulkeul.blogspot.com

</html>

( ! $$ / , #" *
# " ## ; " *
0 0 *"
* $ 0

%&' ( ! LM
$ (

%&' $ " " # * 0 # # ! 0/ ." # 0 "


0 * 6+9
J 0 # %&' # * 00 , 0 *
## # ." * 0 6
## # * = *" > ." *" # 0 # ! 0/ ."
9: ;< '; &9< IJ;< K
## # ." * $ ## # # #0 # # # %&(
## # %
## # ." * # ! # * # #
keulkeul.blogspot.com

## # ." 0 0 #) # #G * #

( " 40 # 0 # # %&' * # # 0 ! # %&(< * #


# #0 # # ## " # #K %&' ( ! L
$ ( ;7

; # # #0 # # #* #* # ) 8 #6 "0
*6 A " * #$ # "4 0 # # %&'
( " 00 0 " " * # 0 $* 6 # * # # #
) 8
/ 0 11A #" 1A 1A # $ #1 1* #1 ** #
; /E." " # * # #
$ * " #0 $ ." 0 " " 0 #
D #" D A " " " "" # "# "
" 0 A " " " "0 E ," 0 #
# # # * $ " " 0 "# " # #
keulkeul.blogspot.com

5 : " # * * #
* < * 5 " ! <K A " * # * #
;# < " )/ ! ;# * $$ # " "#
* " * / ! * " * $ / * ## %&'
" #K ( ! LN
$ ( <'!

; # # #0 # # #* # * # 9: ; #6 "0 *
* # 0 * 6 $ ! 0/ ." *6" %&'
; #0 $ %&' * " # $ * 0 # #
! 0/ ." # 5 # /E." # # 2' # 0 0 # * #
0 # # 0 #
( " 00 0 " " * # 0 $* 6 # * # # #
9: ;
/ 0 11A #" 1A 1A # $ #1 1* #1 ** #
; /E." 9: ; 0 0 # L 0 # # ." #
## $ # ." ! #
keulkeul.blogspot.com

) 0 # #* # # # #+ 0 " 0"
) 0 # #* # # # 0 " " 0"
) 0 # #* * # #) 0 " * #
) 0 # #* ! "0 # 0 " K %&' ( ! LR
$ ( <'!

' * # ! "0 # # ;# 4
$ # "
0 U "0 # *
0 U * ' * ## #
' * # # ## "
## ! ## ! #
0" 9 **
* :
0" &
" 0" : 4
0" : 4
" 0" '
0" : 4 " 0" ;
keulkeul.blogspot.com

# )/ 4 ! 0/ + !
# 2)/ 4 ' * # * #
# 2; # 4 * "
# 2 " *;
%&' ( ! M
$ ( <'!

# 2)/ 4
# )/ 4
0" : 4

0" &
# 2 "

# ;# 4
keulkeul.blogspot.com

# 2; # 4
# "

0" : 4
# * %&' ( ! M
$ ( <'!

* "

*;

" 0" : 4
! 0/ + !

* :
" 0" ;
keulkeul.blogspot.com

0 U *

%&' ( ! M
$ ( <'!

J # ! # 20 # *6 "#
5 # "# # ." # * # 0

5 # " # 9: ; * # 0 * 0 #

5 # " # 59: ; * # 0 0 " 0 *2 ."

& " *" 0 # ! 0/ ." # # <# <


* " *6 "# K

"# * # 0* # "# # 0 "# # ! $ $#


" $" , #" * 0 # * # 0 # #
keulkeul.blogspot.com

! 0/ ." # "# #* # * # 4 0 #

; # #0 # ." #" # # #* #" 0 ."


* 0 # 0* K %&' ( ! M3
$ ( <'!

; # " # # ." # # " # #0 " A " " * #


0 #0 $ ." , %&'
"# # ." #
* * $ *" 0 #
* ! ## " = ! >
* * " 0 # $$ / < $ # 0 # /
# 2 ) ## 0 # *6" )&& , 00 ." " 0 #
" " *" 0 #
" )/ ! ;# ## ," / * 0 " / ! *
keulkeul.blogspot.com

"
* ## 0 " " # * * #
* * ## 0 " " * * * #
." * " " ! <$ # " 0 %&' ( ! MC
$ ( <'!

; # " # 9: ; # " # #0 " *$ 6 00


! 0/ ." *6" 0 # %&'
" # 9: ; # 0 "# 0 *"# K
4 $ " # X 0 # #- $$ / 0 #
* *" *" 0 #
*# * * # " 0 # * # # "" "
4 !/ 4 " * E #0 " " 0 # * 4
* 2 * " " ."
keulkeul.blogspot.com

#? *-" / 0* 4
#2 $ *" # 2
! * $ * # ." * " # "
K " "0 0 # *- " #K %&' ( ! ML
$ ( <'!

; # " # 59: ; # " # #0 " A " " #0


*2 ." 0 " # 0 # # %&' 00 , *" % & 0
" # 59: ; $
" 0 * $ "#
6
) ." # " # #" "
* ) * " ." # " # #" "
$ "# ! ! $ "#
2* D < 2"0 " / $ V /é
20 ## " / 0 ## 0" # V /
"# * D < "# "0 " # " # $ V /é
keulkeul.blogspot.com

"# "< "# "# " # " ##


# $ " # #é
# 4 # #é é* #" / 0* 4
#" $ " # " # %&' ( ! MM
$ ( F( G H

; # / 0 U * # " # 0 " * $ 6 !
* # 0 # # #" #
+ #6 ! * 0 # *6" 0 # #" # *6"
" * 6 ! # * # 0 # # $ # #
# #" " !
; # 0 # # $ ## A " #* # 0#
( 0 "4 "#
" # * #* !
! " " *" $ *
keulkeul.blogspot.com

0 * !< #0 ! #0 # " #
* * " " * !
; 0 # / 0 U "0 0 * ! "0 * #
0 # #* #" " " # * $"# M
%&' ( !
$ ( F( G H

84 0 ! # * # 0 # #* #" !
...
<h4>
<html:panelGrid cellspacing="25" columns="2" >
) *-"
<html:outputText value="Nom : " /> ! * "4
<html:panelGroup> #
<html:inputText size="15" required="true" />
<html:inputText />
</html:panelGroup>

<html:outputText value="Mot de passe : " /> ! "0 *


<html:inputSecret /> * "4 0 # #
</html:panelGrid> * #" "
</h4>
keulkeul.blogspot.com

" 0" 0 A#0


*" 0 A
G (

%&' ( ! MN
$ ( F( ' H

; 0 # Z/ * : [0 * #" # * #
* # #" 0 "# " # # 0 "# " # ! #
; 0 " H " # ." * *- #,
$$ / # "
; #* # 0 *E 0 " H ! #0 * #
#
"#* #
" " * * # 2< ; # < #" & < K
* , , 0" 0 " / ." !
keulkeul.blogspot.com

* < ! < D* / " # 0 " - $$ / !


D) ## #< / * ) ## "#0 " ! # * # # 2 # )&&
( " / ." * < " , $$ / #
" 0 # Z/ " [ %&' ( ! MR
$ ( F( ' H

84 0 0 # *-" %&'
public class Personne {
private String name;
private String firstName;
( # A
private String birthName; *" 0 A
private String job; G (
public Personne(String pN, String pF, String pB, String pJ) {
name = pN; firstName = pF; birthName = pB, job = pJ;
}
public String getName() { return name; }
public void setName(String pName) { name = pName; }

public String getFirstName() { return firstName; }


public void setFirstName(String pFirstName) { firstName = pFirstName;
}
...
public class DataTableBean {
private List<Personne> refPersonne;
public List getPersonne() {
if (refPersonne == null) {
keulkeul.blogspot.com

refPersonne = new ArrayList<Personne>();


refPersonne.add(new Personne("Baron", "Mickael", "17081976", "Développeur"));
refPersonne.add(new Personne("Dupont", "Marcel", "21041956", "Boucher"));
...
} " 0" A
return refPersonne;
} *" 0 A
} G (
%&' ( !
$ ( F( ' H

84 0 #" 0 # *-" %&'


<core:view>
<html:dataTable value="#{outputbean.personne}" var="personne" border="1"
cellspacing="4" width="60%" >
<html:column>
<html:outputText value="#{personne.name}" />
</html:column>
<html:column>
<html:outputText value="#{personne.firstname}" />
</html:column>
<html:column>
<html:outputText value="#{personne.birthdata}" />
</html:column>
<html:column>
<html:outputText value="#{personne.job}" />
* 0 A#0
</html:column>
</html:dataTable> *" 0 A
</core:view> G (
keulkeul.blogspot.com

%&' ( !
$ ( F( ' H

; *$ * # H 0 * * 0 ! *-" #
" " # # Z $ [
Z $ [ #- "0 *- $$ " " * $
" 0 # " "
; $ # # à ## 0 # Z $ [ #
" 0 # *é$ * # 0# * Z $ [
" *" 0 # Z $ [
* $
( " 0 # * "4 $ # 0 ## #
/ * " $ " *
keulkeul.blogspot.com

$ " $ "
0 " $ * "

9 ,F 9 H
I %&' ( !
$ ( F( ' H

84 0 %&' * # #* #
<core:view>
<html:dataTable value="#{outputbean.personne}" var="personne" border="1"
cellspacing="4" width="60%" >
<html:column>
<core:facet name="header" >
<html:ouputText value="Nom" />
</core:facet>
<html:outputText value="#{personne.name}" />
</html:column>
<html:column>
<core:facet name="header" >
<html:verbatim>Prénom</verbatim>
</core:facet>
<html:outputText value="#{personne.firstname}" />
</html:column>
<html:column> # A # $$ /
<core:facet name="header" > Z $ [ - # ##
Date de naissance
, " " " 0 #
keulkeul.blogspot.com

</core:facet>
<html:outputText value="#{personne.birthdata}" />
</html:column>
<html:facet name="footer">
<html:outputText value="#{outputbean.caption}" />
</html:facet> * 0 A#0
...
</html:dataTable> *" 0 A
</core:view> G (
%&' ( ! 3
$ ( F( ' H

( " - # < # " - #0 0 "0 * # $ #


<Z/ * : [ $$ 0 ## * *$
- 00 *-"
; # "#
/ * ) ## # 2 )&& 0 " 0 H
$ ) ## # 2 )&& 0 " #* 0 !
D) ## # # * # 2 # )&& 0 " # ! #
;- " D) ## # 0 * * $ " # * # 2 )&&
." # 00 ." 0 " / ." ! 0 " *
keulkeul.blogspot.com

$ # ."- 2 * ! # * $ *-" $
84 0
& * $ #" D) ## #]^ D < D < D ^
0 *" $ D < D < D < D < D <K
%&' ( ! C
$ ( F( ' H

84 0 %&' = ." >


<head>
<...>
<link href="output.css" tel="stylesheet" type="text/css" >
</head>
<body> * 0 3 A#0
<core:view> *" 0 A G (
<html:dataTable value="#{outputbean.personne}" var="personne" border="1"
cellspacing="4" width="60%" rowClasses="row1,row2"
headerClass="heading" footerClass="footer" >
... .heading {
</html:dataTable> font-family: Arial, Helvetica, sans-serif;
</core:view> font-weight: bold;
font-size: 20px;
color: black;
background-color:silver;
text-align:center;
}
.row1 {
keulkeul.blogspot.com

background-color:#GFGFGF;
}
.row2 {
Background-color:#CECECE;
.footer { " 0" ##
background-color:#000009;
*" 0 A
Color:white;
} G (
%&' ( ! L
$ ( F( ' H

84 0 %&' * # 0 # # %&' * # #
<core:view>
<html:dataTable value="#{outputbean.personne}" var="personne" border="1"
cellspacing="4" width="60%" rowClasses="..." >
<html:column>
<core:facet name="header" >
<html:ouputText value="Nom" />
</core:facet>
<html:inputText value="#{personne.name}" />
</html:column>
<html:column>
<core:facet name="header" >
<html:verbatim>Prénom</verbatim>
</core:facet>
<html:outputText value="#{personne.firstname}" />
</html:column>
</html:dataTable>
</core:view>
keulkeul.blogspot.com

* 0 C A#0
*" 0 A
G (

%&' ( ! M
$ (

; # # # 9: ; * 20 # # * <
# " 0 * ! " # *- #
; # #0 " H « 0 "0 # > 0
# + $$ / " # "
# + # $$ / 0 "# " # #

; # # # 9: ; * # #- "0 * ! #
" " " 0 "# " # " #* " " "
; 20 * # " " "# " #
keulkeul.blogspot.com

* 0 # # * # <& !< A <K


; # / # )/ 4 - # 0 #
0" #."- !E ."-" # " %&' ( !
$ ( F H

; # # + # " # 0 " #0 $ " # "

( 0 "4 "#* # # +
5 # 0 * # 0 " # * # # " # " ."
5# * "0 # -
" " ." 0 #" A & +
; 4 , $$ /
G " " " "# "
J A & + # 40 * * #"
5 $$ # # " "#
keulkeul.blogspot.com

& + A " # " " " " , "


, $$ /
& + A " <& ! # " " " " ,
" "# " " " , $$ / %&' ( ! N
$ ( F H

84 0 / 4 *-" " ."


...
<html:outputText value="Fruit préféré avec SelectItem : " /> 0" 0 A#0
*" 0 A
<html:selectOneRadio layout="pageDirection" G (
value="#{inputbean.oneRadioValue}" />
<core:selectItem value="#{inputbean.bananeItem}" />
<core:selectItem value="#{inputbean.orangeItem}" />
<core:selectItem itemValue="Clémentine" />
<core:selectItem itemValue="Pomme" /> J # *-" * !
<core:selectItem itemValue="Framboise" /> *-" 0 #
</html:selectOneRadio> & +
...
public class InputBean {
private String oneRadioValue;
public String getOneRadioValue() {
return oneRadioValue;
}
keulkeul.blogspot.com

public void setOneRadioValue(String p) {


oneRadioValue = p;
}
public SelectItem getBananeItem() {
return new SelectItem("Banane");
}
...
}
" " A
& + %&' ( ! R
$ ( F H

;6" # * # # + 0 " "* 6 "


* # * $$ # #* # 0 # #* #
) # # 0" F * 0é 0 " " é*" #
*’é é #
; # # + # E! * 6 " 0" #."6"
# " " * # + # 0 " # #
" #* # +
;6 " " # " " * ! ." 0 #"
# " " * 20 & +
; # " " * 20 & + 0 " H * 20
keulkeul.blogspot.com

# " ."
0 # ## # ; # G " #* & +

" %&' ( ! N
$ ( F H

84 0 / # * "4 #

/ # * / # 2; # 4

/ # 2)/ 4

/ # "
keulkeul.blogspot.com

/ # ;# 4

/ # 2 "

%&' ( ! N
$ ( F H

84 0 #" / # * "4 #
<h4><html:outputText value="Fruit préféré avec SelectItems : " /> & 0 $
<html:selectOneRadio value="#{inputbean.oneRadioValue}" /> *6 "
<code:selectItems value="#{inputbean.oneRadioItems}" /> # # + #
</html:selectOneRadio></h4>

<h4><html:outputText value="Ajouter des périphériques : " />


<html:selectManyCheckBox value="#{inputbean.manyCheckBoxValues}" />
<code:selectItems value="#{inputbean.manyCheckBoxItems}" /> ( 0 * ."
</html:selectManyCheckBox ></h4>
." ." #
<h4><html:outputText value="Accessoire préféré : " /> 0 # *
<html:selectOneListBox value="#{inputbean.oneListBoxValues}" />
#
<code:selectItems value="#{inputbean.manyAndOneListBoxItems}" />
</html:selectOneListBox></h4>

<h4><html:outputText value="Choisir équipements préférés : " /> J # " "


<html:selectManyListBox value="#{inputbean.manyListBoxValues}" /> #
<code:selectItems value="#{inputbean.manyAndOneListBoxItems}" />
</html:selectManyListBox></h4>
J # " "
keulkeul.blogspot.com

<h4><html:outputText value="Choisir une marque de voiture : " /> #


<html:selectOneMenu value="#{inputbean.oneMenuValue}" />
<code:selectItems value="#{inputbean.manyAndOneMenuItems}" />
</html:selectOneMenu></h4>

<h4><html:outputText value="Choisir plusieurs marques de voiture : " 0" 0 A#0


/>
<html:selectManyMenu value="#{inputbean.manyMenuValue}" />
<code:selectItems value="#{inputbean.manyAndOneMenuItems}" />
</html:selectManyMenu></h4>
%&' ( ! N
$ ( F H

84 0 #" / # * "4 #
public class InputBean {
private SelectItem[] manyCheckBoxItems = new SelectItem[] {
new SelectItem("Clavier"),
new SelectItem("Souris"),
new SelectItem("Ecran"),
new SelectItem("Unité Centrale"),
new SelectItem("Haut Parleur") J # #0 "
}; 0 "0 # #
*" 0 #
private String[] manyCheckBoxValues; # 2)/ 4
J # 0 "
public SelectItem[] getManyCheckBoxItems() { $$ / "
return manyCheckBoxItems; #
} "

public String[] getManyCheckBoxValues() {


return this.manyCheckBoxValues;
keulkeul.blogspot.com

}
J # 0 "
public void setManyCheckBoxValues(String[] p) { *$ "
manyCheckBoxValues = p; #
} "
}

%&' ( ! N3
$ ( 42

; # ## # ." *é # -é 0 *-"
0 # # # ## # 0 0 # X* 0 * " #
# " # *"< * # 0 # #< #K
; # 0 # # %&' / * ## * 0 "# / "
" J+) 0 ." # #
; ## J+) 0 # # ## " #
0 0 * $ "
00 # ."-" 0 # %&' 0 " " #
* # "# 0 # # * / /
keulkeul.blogspot.com

J+) 0 # $ " ## # #" #


(+ 0 " ! # *" 2 * *" 0 #
(+ 0 " *" *" 0 #
K 0 * * # * E 0 %&' ( ! NC
$ ( 42

9 / * #0 0 "4 0 # # %&'
D
A 0 # * ) ## #
- 0 E# 0/ # *
7 " )
0 "# * * * # * E
D 0 + 0 0
0
* $ "

D " )7 D ; D % D
## ,
#
## ,
* "
keulkeul.blogspot.com

#
" 0" : 4
< ' 6 < 0

< ; ' 6 ## ,
#
0" : 4 %&' ( ! NL
6

' #) 4 0 * 0 # " # # $ #
4" # ## #, ."H à é0 #
' #) 4 # *é$ 0 " ## # * - #
# é #é # 0 # éé " *é " *" 2 *
? ."- 2 " *- # #* 20 ' #) 4 ."- 2
* " # %&'
Q" * 0 ##"# * # é< - A
' #) 4 è # ## " # ;- # * - A #
keulkeul.blogspot.com

# é " # * é/ * #
/ ." " ."H < é " # * # # #*
' #) 4 %&' ( ! NM
6 6

' #) 4 # ## " # 0 # # #
# * %&' : " $ # # 0 ## *- 4 * #
$ # ## #

J A ' #) 4 # 40 * #" "* #


" %&( # A 0 ##

Q" 0 " * $ A c
84 ) 4 é* "4 é é #* ."H * é0 #

## ! Q" " # * # ## ! # 0 #"


keulkeul.blogspot.com

G D é* à * - * # 0 # # J+G D

*$ *é " *" 2 * 0 é é

( # *- " # / # # ." # *" * * "#…


%&' ( ! N
6 6

84 0 0" - A ' #) 4
package beanPackage;
public class FacesContextBean {
private String name;
public String getName() {
return name;
}
public void setName(String pValue) {
name = pValue;
}
public void apply() {
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
System.out.println(context.getRequestPathInfo());
System.out.println(context.getRequestServletPath());

Iterator myIterator = context.getRequestParameterNames();


while(myIterator.hasNext()) {
Object next = myIterator.next();
System.out.println("Nom du paramètre : " + next);
Map requestParameterValuesMap = context.getRequestParameterValuesMap();
keulkeul.blogspot.com

Object tabParameter = requestParameterValuesMap.get((String)next);


if (tabParameter instanceof String[]) {
System.out.println("Valeur du paramètre : " + ((String[])tabParameter)[0]);
}
' #) 4 A
}
} *" 0 A
} 6
%&' ( ! NN
6 6

84 0 #" 0" - A ' #) 4


...
<body>
<core:view>
<html:form>
<html:inputText value="#{facescontextbean.name}" />
<html:commandButton value="Valider" action="#{facescontextbean.apply}" />
</html:form>
</core:view>
</body>

$ # 4 A#0
*" 0 A
6
keulkeul.blogspot.com

%&' ( ! NR
0 * $

00 # ." #= # ! #># " # #


* # *E # * " #
;- E# "4 = $ #>* # 0 # #* " 0 "
# $ * ## ? *" ' #) 4
+ 0 " H é ## *’ é* * à é$é
*’" 0 # ! 0/ ." 0 " *$ # é à
#" *’" é é " # *" 0 ##"# * *
; $ D %&' $$ 0 ## *6 0#" " "
0 * # 0 # # ." 0 # " "
keulkeul.blogspot.com

+ #6 ! *6" 20 * 00 = ! > ."


#0 * 0 "# #," !
J ! # * " * #0 0 #
# * 20 J+) 0
%&' ( ! R
0 * $

5 # < $ " * * # ## " # * #


* $ " # #" * # 0 0 # * 20 J+) 0
package beanPackage;
public class BackingBeanExemple {
private String nom; ; = ! >
private UICommand refCommand; # 0
" !
public String getNom() { return nom; }
public void setNom(String pNom) { nom = pNom; }

public void setNomAction(UICommand ref) {


refCommand = ref;
}
public UICommand getNomAction() { & 2
return refCommand; $ *6"
} 0 # %&'
}
keulkeul.blogspot.com

" "* 0 ! %&(< # = ! >


# " # $ 0 6 " * !
<html:commandButton binding="#{backingbean.nomAction}" />
%&' ( ! R
0 * $

84 0 1* # " " 0 "


...
<body>
<core:view>
<html:form>
<html:inputText value="#{backingbean.name}" binding="#{backingbean.composantNom}" />
<html:commandButton value="Transformer" binding="#{backingbean.commandButton}"
action="#{backingbean.doProcess}" />
</html:form>
</core:view>
</body>

! A#0
*" 0 A
J " 0 * $0
J " * #"
0 # 4 J "
keulkeul.blogspot.com

* #

; " / ! # #
0 ## 0 %&' ( ! R
0 * $

84 0 #" 1* # " " 0 "


package beanPackage;
public class BackingBean {
private String nom = "Baron";
private HtmlInputText composantNom;
private HtmlCommandButton commandButton;

public String getName() {return name; }


public void setName(String pName) {this.name = pName; }

public void setComposantNom(HtmlInputText pCommand) {composantNom = pCommand; }


public HtmlInputText getComposantNom() { return composantNom; }

public void setcommandButton(HtmlCommandButton pCB) {this.commandButton = pCB; }


public HtmlCommandButton getCommandButton() { return this.commandButton; }

public void doProcess() {


if (commandButton != null) {
this.commandButton.setDisabled(true);
keulkeul.blogspot.com

} ! A
if (composantNom != null) {
*" 0 A
composantNom.setValue("Nouvelle Valeur");
} 0 * $0
}
}

%&' ( ! R3
! $ 99 ( $

( " 6 # " ! # 0 ## *
& $$ / # " # *6" $ "
U # #0 " 6 " * !
;’ (+ %&' $ " ’ A ! $ 0 " 0 * #
## ! # ." 0 " H $$ / * #" 0 ! %&(
J A ' # ## ! # é #é 0
&8G8 +:\W+ ' < &8G8 +:\W7 < &8G8 +:\W8
&8G8 + \W' : ;
#" 4 0* * ## !
5 4 * * ## !
keulkeul.blogspot.com

;6 (+ $ " * # *$ " # ## " #


# & 2' # ## ! & 2 1! & 2
# &" 2& ! 1 ! &" 2
# 5 & ! 1! 5 %&' ( ! RC
! $ 99 ( $

J A ' # ## ! # * # " * #" ##


% " 0 4 0
( " 40 * # ## ! # * #" 0 ! %&( $ " 0 ##
0 4 " %&' ' #) 4
** ## ! & ! *< ' # ## ! ## ! A " " ## ! ,
" 0 # * $ 0 *
& * # " ## ! 6 # 0 # ## ," 0 #
84 0 * # " # ## *6" ' # ## !
// Déclaration d’un Message
FacesMessage myFacesMessage = new FacesMessage();
myFacesMessage.setSeverity(FacesMessage.SEVERITY_INFO);
keulkeul.blogspot.com

myFacesMessage.setSummary("Un petit résumé");


myFacesMessage.setDetail("Mon message qui ne sert à rien");

// Transmission d’un Message


FacesContext myFacesContext = FacesContext.getCurrentInstance();
myFacesContext.addMessage(null, myFacesMessage);

%&' ( ! RL
! $ 99 ( $

; /E." 9: ; 0 0 # * "4 # #0 # # #
0 " $$ / # ## ! #
Z/ ## ! #[ $$ / "# # ## ! #

Z/ ## ! [ $$ / # ## ! # ## #," ** 0 #

; # # # # " # #" #
$ * ." 6 * *" 0 # " ." 0 " ## !

#/ D5 ." 0 # # ## ! # *

#/ D&" 2 ." 0 # # ## ! # #"


keulkeul.blogspot.com

0 ." 0 # # " " *6 * # $$ /

2 " 0 # E *6 $$ / # ## ! # G " # 0 ## #
" # 0 * $ "
%&' ( ! RM
! $ 99 ( $

84 0 $$ / # ## ! # " # "
public class BeanMessages {
private String name;
public String getName() { return name; }
public void setName(String p) { this.name = p; }

public void validAction() {


FacesMessage facesMessage = new FacesMessage();
facesMessage.setSeverity(FacesMessage.SEVERITY_INFO);
facesMessage.setSummary("Validation");
if (name == null || name.equals("")) {
facesMessage.setDetail("(nom inconnu)");
} else {
facesMessage.setDetail("(nom connu :" + name + ")");
}

FacesContext facesContext = FacesContext.getCurrentInstance();


facesContext.addMessage(null, facesMessage);
keulkeul.blogspot.com

facesContext.addMessage(null, new FacesMessage(


FacesMessage.SEVERITY_INFO, "Validation 2", "Une seconde ligne"));
}
...
}

## ! # *"
0 A ! $ %&' ( ! R
! $ 99 ( $

84 0 #" $$ / # ## ! # " # "


<%@taglib prefix="core" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="html" uri="http://java.sun.com/jsf/html"%>

<html>
$$ / ! # "#
...
<body> $ *6" "
<core:view>
<html:form>
<html:messages showDetail="true" layout="table" showSummary="true"/><br>
<html:outputText value="Nom : "/>
<html:inputText value="#{beanmessages.name}"/><br>
<html:commandButton value="Valider" action="#{beanmessages.validAction}"/>
<html:commandButton value="Annuler" action="#{beanmessages.cancelAction}"/>
</html:form>
</core:view>
</body>
</html>
keulkeul.blogspot.com

$ A#0 *" 0 A
! $

%&' ( ! RN
! $ 99 ( $

84 0 $$ / # ## ! 0 "# " # #
<%@taglib prefix="core" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="html" uri="http://java.sun.com/jsf/html"%>

<html> ## 0 " * $ $ A#0 *" 0 A


... # # "# 0 # #
<body> +* $ *" 0 # ! $
<core:view> 0" : 4
<html:form id="logonForm">
<html:outputText value="Nom : "/>
<html:inputText id="myIdName" value="#{beanmessage.name}"/><br>
<html:message for="myIdName" tooltip="true" showDetail="true »
showSummary="true"/><br>
( # ." ## ! #
<html:outputText value="Email : "/> ## , 6* 2
<html:inputText id="myIdEmail" value="#{beanmessage.email}"/><br>
<html:message for="myIdEmail" tooltip="true" showDetail="true »
showSummary="true"/><br>
keulkeul.blogspot.com

<html:commandButton value="Valider" action="#{beanmessage.validAction}"/>


<html:commandButton value="Annuler" action="#{beanmessage.cancelAction}"/>
</html:form>
</core:view>
</body> 9
</html>
= >
$ %&' ( ! RR
! $ 99 ( $

84 0 #" $$ / # ## ! 0 "# " # #


public class BeanMessage {
private String name 2+*
private String email; ! ' # * #
* $ #*
public String getName() { return name; }
public void setName(String p) { this.name = p; } 0 # #
( # ." 2+*
public String getEmail() { return email; }
public void setEmail(String p) { this.email = p; } 00 , ! '

public void validAction() {


FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.addMessage("logonForm:myIdName", new
FacesMessage(FacesMessage.SEVERITY_INFO, "Validation Name", "Nom
saisi " + this.name));
facesContext.addMessage("logonForm:myIdEmail", new
keulkeul.blogspot.com

FacesMessage(FacesMessage.SEVERITY_INFO, "Validation Email",


"Email saisi " + this.email));
}
...
}

## ! A *"
0 A ! $ %&' ( !
! $

$ # $! 4 0 * $ !" # # #
0 # 0 " 6 00 78 * # # Z 00 [
5 #Z $ [ * "4 $ ## , # !
Z ## ! " * [ ## " # ## ! # # #
Z $ ![ * ." 0 * $ " # # " # #
# Z $ ![ * "4 $ ## , # !
Z* $ " [ # 0 * $ "
Z#"00 * [ # #"00 0 6 00
...
<application>
<message-bundle>resources.ApplicationMessage</message-bundle>
keulkeul.blogspot.com

<locale-config>
<default-locale>en</default-locale>
<supported-locale>fr</supported-locale>
<supported-locale>sp</supported-locale>
</locale-config>
$ # $!4
</application>
%&' ( !
! $

5 # # 0 ## * * * # # ."
0 #" * # $ / # 0 0 #Z # " " * [
5 #Z # " " * [ * "4 $ ## , * ."
Z # [ * ## " # ## ! # # #
Z [ #0 *6 * , ## " Z # [
<application>
<resource-bundle>
<base-name>resources.ApplicationMessage</base-name>
<var>bundle</var>
</resource-bundle>
</application>

5 # # / ! * # ## " # # $$ "
keulkeul.blogspot.com

* # 0 ! %&( , 6 * * # Z * " * [
<core:loadBundle basename="resources.ApplicationMessage" var="bundle" />

; # ## " ## 40 #0 6 * * # #
" " # # 8;
%&' ( !
! $

84 0 $ " " # " ## " * #


<%@page contentType="text/html"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="core"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="html"%>

<html>
<head>
<title>Formulaire JSF avec un Bean Managé</title> + +
</head>
<body>
<core:view>
<core:loadBundle basename="CoursesMessages" var="bundle" />
<html:form>
<html:outputText value="#{bundle.EMAIL_ADRESS_MESSAGE}"/>
<html:inputText value="#{registrationbean.email}"/><br>
<html:outputText value="#{bundle.PASSWORD_MESSAGE}" />
<html:inputSecret value="#{registrationbean.password}"/><br>
keulkeul.blogspot.com

<html:commandButton value="#{bundle.LOGIN_MESSAGE}" />


</html:form>
</core:view>
</body> ) " # # ## ! #W$ 4
</html>

EMAIL_ADRESS_MESSAGE = Adresse Email ! * D " * A#0


PASSWORD_MESSAGE = Mot de Passe
LOGIN_MESSAGE = Connecter %&' ( ! 3
! $

84 0 # $ " ." " # " ## " 0 "


# # %&'
<html>
...
<body>
<core:view>
<html:form>
<html:outputText value="#{bundle.EMAIL_ADRESS_MESSAGE}"/>
<html:inputText value="#{registrationbean.email}"/><br>
<html:outputText value="#{bundle.PASSWORD_MESSAGE}" />
<html:inputSecret value="#{registrationbean.password}"/><br>
<html:commandButton value="#{bundle.LOGIN_MESSAGE}" />
</html:form>
</core:view>
</body>
</html>
keulkeul.blogspot.com

<application>
<resource-bundle>
<base-name>resources.ApplicationMessage</base-name>
<var>bundle</var> +-
</resource-bundle>
</application>

$ # $!4 %&' ( ! C
) # * #* # *" *E * "
#0 E # *-" ."H # * 20 / î #* è #
# ## *é$ # 0 * # "# 0 é# é# 0 * # 20 # *
* é # < !< A <…
# * * é # #- ##" # ."-" / î * è #
0 " H *" " 20 * * é 0é #

#0 *" $ ! #
' ! # $$ / ! *-" *
$$ / * #" " $ 0 / # 0 6" # "
$ * # *" 20 *6" # "
keulkeul.blogspot.com

) $ # # *-" *
## ," 0 # * 20 # #
##" ." 6" # " # # " / î * 4 #0
$ * 6 %&' ( ! L
; # ## " # * * ## 00 #
: "# # 0 # # 99 ( " # # #*
$ " ## " # * * #
; # ## " # #* #" %&( " #
( " " # "
# " # ## * *# $ " #0 /E." %&' * #" %&(
# * $ 0 ! ." * #" 6" # * #
" %&(
keulkeul.blogspot.com

) ## * *# * /E." %&'
5 : 0 " # * * *6/ "
" 0 " # *
%&' ( ! M
&

0 # 0 #
) 0E ) 0E

."H # 00 2 ( ## ( ## ( ##
' # G D ." # # 8 # G * # 8 #
1

0 # 0 #
) 0E ) 0E
6 5 2
0 # * J0*
( ## + ( ##
*
' # #0 # 8 # 00 8 #
G " #
keulkeul.blogspot.com

4
8 "#* ) #
3
8 "#* ) #
1 "* G *

%&' ( !
&

5 # # *-" 0 # * $ * 20 J++ 0"


0 4 0 " 0 # / 0" : 4
1 ;- 0 2 " 0 # "#* #0
E # #" *G " # 00 ." # # #
2 & # é"## < "
;-é 0 D ! " *$ *è ## é "
0 4 0 0" # # * # " # *" *è
5 & # é"## < " 0 ##"# …
4 & # é / "é< !é é * ## ! # *- "#
keulkeul.blogspot.com

* é 0 7 7 6

3 & # é / "é< # * é 0 #*
/ ! * 0 ! * # ## ! # *- " # !é é é#
* é 0 7 7 6
N
%&' ( !
&

5 # # *-" 0 # * $ * 20 J+ " 0"


0 4 0 0 # / " 0" : 4
1 ;- 0 2 " - 0 D ! "
0 #* 0 E # -2 0 #K
2 (" # # * # " # *" *è 0 é# #* #
5 & # é"## < " 0 ##"# …
4 & # é / "é< !é é * ## ! # *- "
* é 0 7 7 6
keulkeul.blogspot.com

,
J (
1 9

%&' ( ! R
& A J42 B

: "# 0 # # ." 0 - $ G " 9 *


0 " 40 * #) # J+ " 0" J++ 0"

;- 0é * - $ G " 9 * * $ " * #
0 0 é é# 0 "
8$$ " # " A )

& " 0 - A )

& " 0 0 *" 0 # " #é 0 " *$


é à é0
keulkeul.blogspot.com

*è * " $ " " * #

(
A 9 B

%&' ( !
& A J42 B

J A ) $ " * "4 é/ * #
A ! # A … / D# ) 84 0 00 é #*
-é 0 ( ## G *

& !! #& ! … / D# ) 84 0 00 é 0 è#
-é 0 J0* * G " #

5 # #* # A # J++ 0" # "#* #0 E #


# # #* # - " #" *G " $
8* G " 9 *
( # *
keulkeul.blogspot.com

0/ # 2
: " 0 " "0
# " # ." ##" #
* #0 E #

%&' ( !
& A J42 B

( ##"# * # 0 - (+
#" *G " # 0 ! # A K # * #
G " # 4 0 * ! # A K H *" 0 ##"#

& G " d] " < # " # # # à "


" # " à" 0 0 é é *" *è * "
" * $ " *"

" é "0è " *-" 0 0 é é *" *è * "


" ## " *"

& G " ]] " < " "0E " *-" 0 0 *"


keulkeul.blogspot.com

*E

" # 0 ! #& !… 2é à é0 # #
4 0 * ! #& !… H *" 0 ##"#
%&' ( !
$ :

; # " 0 # *
/ î #* è # " " é ."
À" # * # 0# *’" # ! 0/ ." %&'
5 $$é # " # * #0 #
20 20 * " " < " 2 "0
0 $* $ !
41 ' 5! # 41 #" *
41 + ! 5! # 41 #" 0 E
! 2 # " 0 E # 0 # 0
! "0 !J# * 0 # # # E #* ! "0
keulkeul.blogspot.com

# " # # 4 0 = < >< = e >< = >< K


* $ # * #
" 2) * * * " # 0 " #
" 2&2 #0 $ E 4 "# $ " 2) * 3
%&' ( !
$ :

84 0 " # *6" =# >


<html>
...
# A#0 *"
<body> 0 A
<core:view>
<html:form>
<html:outputText value="#{beanconverter1.price}">
<core:convertNumber type="currency" currencyCode="EUR"
minFractionDigits="4" />
</html:outputText>
</html:form>
</core:view> public class BeanConverter1 {
</body> private double price;
</html>
public BeanConverter1() {
this.price = 50.50d;
}
public double getPrice() {
keulkeul.blogspot.com

return price;
}
public void setPrice(double pPrice) {
this.price = pPrice;
}
}
) *"
0 A %&' ( ! C
$ :

84 0 #" " # *6" = >


<html>
...
<body>
<core:view>
<html:form>
Prix :
<html:intputText value="#{beanconverter1.price}" >
<core:convertNumber minFractionDigits="2" />
</html:inputText><br>
<html:commandButton value="Envoyer" />
</html:form>
</core:view>
</body>
</html>

# A#0 *"
keulkeul.blogspot.com

0 E# #
0 A

# < "
* # # K
%&' ( ! L
$ '

; # 5 : 0 # *
/ î #* è # * "/ "
À" # é! * # 0# *’" # ! 0/ ." %&'

<html:outputText value="#{packageBean.facturedate}">
<core:convertDateTime type="date" dateStyle="long"/>
</html:outputText>

5 $$é # " # * #0 #
20 20 * " * < " /
keulkeul.blogspot.com

* &2 #2 0 ## * * #/ < *" < !< $" < /


&2 #2 0 ## * 6/ " #/ < *" < !< $" < /
( $" # 0 " " 5
; / 4* #
%&' ( ! M
$ '

84 0 " # *6" * = >


...
<body> #3 A#0 *"
<core:view>
<html:form> 0 A
<html:outputText value="Nom : " />
<html:inputText value="#{beanconverter2.name}" /><br>
<html:outputText value="Nombre de tickets : " />
<html:inputText value="#{beanconverter2.tickets}" >
<core:convertNumber type="number" integerOnly="true" />
</html:inputText><br>
<html:outputText value="Date : " />
<html:inputText value="#{beanconverter2.date}">
<core:convertDateTime type="date" dateStyle="medium" />
</html:inputText>
<html:commandButton value="Valider" />
</html:form>
keulkeul.blogspot.com

</core:view>
</body>
</html>

%&' ( !
$ '

84 0 #" " # *6" 5 = >


public class BeanConverter2 {
private long tickets;
private String name;
private Date date;

public BeanConverter2() {
tickets = 50;
name = "Mon Nom";
date = new Date();
}

public long getTickets() { return tickets; }


public void setTickets(long pTickets) { tickets = pTickets; }

public String getName() { return name; }


public void setName(String pName) { name = pName; }
keulkeul.blogspot.com

public Date getDate() { return date; }


public void setDate(Date pDate) { date = pDate; }
}

) A
*" 0 A
%&' ( ! N
$

5 # # X* # "#* # # 0 ." #<


* # ## ! # # A " # "' #) 4
8 " # # # #/ ## ! / ## ! #
0 ## *- $$ / " ## ! 0 # " - #

U , / ." 0 # # ## " *< ."


0 * # 0 # - ! * - "
) # A#0 *"
84 0 0 A
keulkeul.blogspot.com

...
<html:outputText value="Prix : " />
<html:intputText id="priceId" value="#{beanconverter1.price}" >
<core:convertNumber minFractionDigits="2" />
</html:inputText><html:message for="priceId" /><br>
<html:commandButton value="Envoyer" />
...
%&' ( ! R
$

84 0 * = > ## ! #
...
<core:view> #3 A#0 *"
<html:form>
<html:outputText value="Nom0: A" />
<html:inputText value="#{beanconverter2.name}" /><br>
<html:outputText value="Nombre de tickets : " />
<html:inputText id="ticketsId" value="#{beanconverter2.tickets}" >
<core:convertNumber type="number" integerOnly="true" />
</html:inputText><html:message for="ticketsId" /><br>
<html:outputText value="Date : " />
<html:inputText id="dateId" value="#{beanconverter2.date}">
<core:convertDateTime type="date" dateStyle="medium" />
</html:inputText><html:message for="dateId" /><br>
<html:outputText value="Liste des messages : " /><br>
<html:messages />
<html:commandButton value="Valider" />
</html:form>
keulkeul.blogspot.com

</core:view>
</body>
</html>

%&' ( !
$

; # ## ! # # * #0 * # ## #* #"
$ / ## " * * 0 ** #

; #$ / # ## " # $ / "$ 0 0 # #
# #* # 0 A 4$ #*
0 * %&' 2$ # 0 44A

( " *$ " ## ! 0 " " *


) " $ / 0 0 #* # 0 # "
keulkeul.blogspot.com

5 $ / 0 0 #* # $ # $! 4

) 0 # #, * $

*$ " *" 4 * # # #
%&' ( !
$

84 0 *$ * # ## ! # *- "#* #
...
<application>
<messsage-bundle>beanPackage.MyMessages</message-bundle>
$ # $!4 *"
</application>
</faces-config> 0 A

...
javax.faces.convert.NumberConverter.CONVERSION = Problème pour le champs
"Nombre de tickets"
Javax.faces.convert.NumberConverter.CONVERSION_detail = "{0}" : La donnée
n'est pas un nombre valide
...

*.html, *.jsp, ...


keulkeul.blogspot.com

web.xml
MyApp
WEB-INF
faces-config.xml 2 ## ! # 0 0 #

classes MyMessages.properties
%&' ( !
00 # ." " ."H %&' 0 ## ! 0
" *é$ 0 2 * %&'
; # * * é # # ! é 0
2 * %&' H # 0 4 0 " ."H * é
’ # 0 #* * " $ " "
& " ."H # *’ " # # *" $ " *
#" " 0 ! < 0 ##"# $$ " "A " #
# * * é #* "# # 0 # # *’" " %&'
+ 0 " * H " * 0 ## " 0 ##"# *
keulkeul.blogspot.com

# " # * ’ " * 0 " " # *


0 # ." * # " $ "
; 0 # * 6 " * " , " *$
* " *" 2 * *6" ."H %&'
%&' ( ! 3
; 0 # 0 ##é à * # !é é 0 * #
2 *
; $ * é * ## "# ." #
0 # #* 20 ) * ) * " 0 4 0
0 è# 0/ # 4 &7 " < * ."H
H * !é * #7 7
5 è # 0/ # # 2 " <D !
" < * 4 # 0 # 4é " é #
+ ’2 * 0 #* # < * *$ * #

; # * $$é # # # # * ’" # " # A # é #
keulkeul.blogspot.com

’2 * 0 # *’ " # ." 0 " ."é #


’" # " D 6 99
A B
%&' ( ! C
0 # 0 #
) 0E ) 0E

."H # 00 2 ( ## ( ## ( ##
' # G D ." # # 8 # G * # 8 #

Q" *
* ]] "
0 # 0 #
) 0E ) 0E

0 # * J0*
( ## + ( ##
*
' # #0 # 8 # 00 8 #
G " #
keulkeul.blogspot.com

8 "#* ) #
&
8 "#* ) #
& 1 "* G *

%&' ( ! L
84 0 0 ## " 0 ##"# * #

; #0 E #*
# # 0 #
0 # 0
keulkeul.blogspot.com

; #0 E #* #
# 0 # 0 !
* # # #
* #0 " "

%&' ( ! M
84 0 #" 0 ## " 0 ##"# * #
...
<core:view>
<html:form>
...
<html:outputText value="Date : " />
<html:inputText id="dateId" value="#{beanconverter2.date}">
<core:convertDateTime type="date" dateStyle="medium" />
</html:inputText><html:message for="dateId" /><br>
<html:outputText value="Liste des messages : " /><br>
<html:messages />
<html:commandButton value="Valider" />
<html:commandButton value="Annuler (sans immediate)" action="CancelAction" />
<html:commandButton value="Annuler (avec immediate)" action="CancelAction"
immediate="true" />
</html:form>
</core:view> <faces-config>
<navigation-rule>
<from-view-id>*</from-view-id>
keulkeul.blogspot.com

<navigation-case>
#+ * A#0 <from-outcome>CancelAction</from-outcome>
*" 0 A <to-view-id>/index.jsp</to-view-id>
</navigation-case>
</navigation-rule>
...
$ # $ ! 4 *" </faces-config>
0 A
%&' ( !
( " F …
# * # 0 0 )
keulkeul.blogspot.com

%&' ( ! N
"

;6 A $* * * * # # * #6 ##" ." #
$ # ." ## * #
; # A #" # #0 " * # 00 #"
: "# # 0 # #" # #0 " # # * * #
0 " 40 * #G * #
( " ." " # * #G * # $ * #" $ *
$ * c
$ 0 # * * #
keulkeul.blogspot.com

$ " *6" * #
$ 0 ! * "# 0 # L
$ $ *6" *
K %&' ( ! R
" &

0 # 0 #
) 0E ) 0E

."H # 00 2 ( ## ( ## ( ##
' # G D ." # # 8 # G * # 8 #
1

0 # 0 #
) 0E ) 0E
6 2
0 # * J0*
( ## + ( ##
*
' # #0 # 8 # 00 8 #
G " #
keulkeul.blogspot.com

8 "#* ) #
3
8 "#* ) #
1 "* G *

%&' ( ! 3
" &

) 0 # * $ * 20 J++ 0" * "


0 / *" 0 ##"# * #
1 ;- 0 2 " 0 # "#* #0 E #
#" *G " # < 00 ." # # # * #
2 & # 1 " * é"## < "

G 0 # 0 " *é * #" …

& # 1 " é / "é< #


* é 0 #* / ! * 0 ! * # ## ! # *- "
# !é é é# * é 0 7 7
keulkeul.blogspot.com

6
#
A $ #
B & 9
%&' ( ! 3
" & A 42 B

; # 0 # # 0 - $ 8* G " 9 *
0 " 40 * #G * # J++ 0"

8* G " 9 * # " # "# $ * G " 9 *

J A 8* G " 9 * $ " # 0 0 é é# 0 "


A " " A G * # ’é * *

J A G * $ " " é/ *
* ' #) 4 < J+) 0 0 < A "
keulkeul.blogspot.com

/ D# G * 84 0 / ! *’ $$ " *

: #’ 4# " " * * < " 4 0 *


20 G * 84 0
%&' ( ! 3
"

( " " # " G * K


# " # ## * *# $ " #0 /E." %&'
# * $ 0 ! ." * #"

J # ## * *# $ " #
* 5 " ! * #* #* 20 5 "
* ; ! ! * #* #* 20 ; !
* ; !/ * !" " * 20 + !

5 # "# # #< # # #$ " ## # "#


keulkeul.blogspot.com

4 " " 4
" "
* ! " " # *" * ." #
%&' ( ! 33
"

84 0 " $ " <* # / 0# * # * #K


...
<html:form>
<p>
<html:outputText value="Veuillez saisir votre numéro de compte (10
chiffres) : " />
<html:inputText id="compteId" value="#{validatorbean.compte}" >
<core:validateLength maximum="10" minimum="10" />
</html:inputText><html:message for="compteId" />
</p>
<p>
<html:outputText value="Veuillez saisir votre taille (comprise entre 1.2 et
2.0) : " />
<html:inputText id="tailleId" value="#{validatorbean.taille}" >
<core:validateDoubleRange maximum="2.80" minimum="1.20"/>
</html:inputText><html:message for="tailleId" /><br>
<html:commandButton value="Envoyer" />
</p>
keulkeul.blogspot.com

</html:form>
...
# * * * A#0 *"
0 A "

%&' ( ! 3C
"

"# # " ." %&' 0 0 # # * *" #


# * G * #
+ 0 " H é ## * 0 " *é 00 # #0 0 #
G * #
%&' $$ 0 ## * * $ 0 ! ." #
* # # "/ # " # * # ## # %
5 "4 00 / #* # f" # , *# !"
J # * # Z * [
keulkeul.blogspot.com

J # * 6 " *

00 # ." # 0 * * #
." # 0 # #* 20 J++ 0" %&' ( ! 3L
"

;6" # *6" # 0 " " * ," 0 #


0 ## 0 6 0 * 6 $ G *
J A G * $ " " é/ *
* ' #) 4 < J+) 0 0< A " / D#
G * 84 0 / ! *’ $$ " *
0 *’ é* " 4 * ’ 00 %&'
0 é$é #" 0 # * * é # à *
" " * * é

;’ 4 0 0 *’ * ." # * #’ # 0 #
keulkeul.blogspot.com

0 ##é
& 4 0 *é /é < " *é 00 " à 0 * / !
# ## ! # à " ’ A ' #) 4
%&' ( ! 3M
"

( " " # " ## * 20 G * < $ " *


* # $ / * $ !" $ # $! 4
+ $ " * $ * # # * ## " # 0 "
0 G *
<validator>
<validator-id>myValidatorId</validator-id>
<validator-class>beanPackage.MyValidator</validator-class>
</validator>

( " " # * * #" 0 ! %&(< $ " " #


# Z * [* # 0# *6" 0 # %&'
keulkeul.blogspot.com

<html:inputText value="#{...}" ... >


<core:validator validatorId="myValidatorId" />
</html:inputText>

%&' ( ! 3
"

84 0 " # * # Z * [
public class PersoValidator implements Validator {
public void validate(FacesContext fc, UIComponent comp, Object ref)
throws ValidatorException {
String myValue = null;

if (fc == null || comp == null || ref == null) {


throw new NullPointerException();
}
( # G * A *"
myValue = ref.toString(); 0 A "
final String magicNumber = "123456789";
if (!myValue.equals(magicNumber)) {
throw new ValidatorException(new FacesMessage(
FacesMessage.SEVERITY_ERROR,
"Problème de validation", "numéro magique erroné"));
keulkeul.blogspot.com

}
}
} ... $ # $!4 *"
<validator>
<validator-id>myValidatorId</validator-id>
0 A "
<validator-class>beanPackage.PersoValidator</validator-class>
</validator>
</faces-config>
%&' ( ! 3N
"

84 0 #" " # * # Z * [
<core:view>
<h4><html:outputText value="Utilisation d'un validator personnalisé :
balise validator" /></h4>
<html:form>
<p>
<html:outputText value="Veuillez saisir votre numéro magique (10
chiffres) : " />
<html:inputText id="compteId" value="#{persobean.magicnumber}" >
<core:validator validatorId="persoValidatorId"/>
</html:inputText><html:message for="compteId" showDetail="true"
showSummary="true"/>
</p>
<p> 0 # ! * A#0 *"
<html:commandButton value="Envoyer" />
0 A "
</p>
</html:form>
</core:view>
keulkeul.blogspot.com

%&' ( ! 3R
"

;6" # * 6 " * *" 0 # J++ 0" ,


* #6 00" #" 6" # *6"

+ $ " * $ " , 6 " * " 40 ## ."


* #! / * * *
<html:inputText value="#{...}" validator="#{myVal.validate}" ... >
...
</html:inputText>

; * / * 6 # 0 # 0 # < " $ # *
#0 #! " * / * * * 6 $
keulkeul.blogspot.com

G *
;6 * 00 / # ."6 # $
, 6 00 * * $$ * " # *
%&' ( ! C
"

84 0 " # * 6 " *
public class PersoBeanValidator {
private String magicNumber;
( # G * A
public String getMagicnumber() {
return magicNumber; *" 0 A "
}
public void setMagicnumber(String magicNumber) {
this.magicNumber = magicNumber;
}

public void validatePerso(FacesContext fc, UIComponent comp, Object ref)


throws ValidatorException {
String myValue = null;

if (fc == null || comp == null || ref == null) {


throw new NullPointerException();
}

myValue = ref.toString();
keulkeul.blogspot.com

final String magicNumber = "123456789";


if (!myValue.equals(magicNumber)) {
throw new ValidatorException(new FacesMessage(
FacesMessage.SEVERITY_ERROR, "Problème de validation",
"numéro magique erroné"));
}
}
}

%&' ( ! C
"

84 0 #" " # * 6 " *


<core:view>
<h4><html:outputText value="Utilisation d'un validator personnalisé :
attribut validator" /></h4>
<html:form>
<p><html:outputText value="Veuillez saisir votre numéro magique (10
chiffres) : " />
<html:inputText id="compteId" value="#{persobeanvalidator.magicnumber}"
validator="#{persobeanvalidator.validatePerso}" />
<html:message for="compteId" showDetail="true" showSummary="true"/>
</p>
<p><html:commandButton value="Envoyer" /></p>
</html:form>
</core:view>

0 # " * A#0
keulkeul.blogspot.com

*" 0 A "

%&' ( ! C
"

( " F …
8 " * # #0 0 # # #0 " # *
keulkeul.blogspot.com

%&' ( ! C3
$ $

%&' $ " " # *6 ## 00 / * #


*E # * ! # *6 # * # (+ &D ! &7:
) # 0 # # %&' 0 " * # #
)6 # " # "

5 # A #0 " * # #
) # * # " "# # # ! #

; # *6 # # $ * #" *6
" # " " " "
;6 (+ %&' $ " * "4 20 # *6 #
keulkeul.blogspot.com

)/ ! * " G " )/ ! 8 # # *" / !


* " *6" 0 # * 20 J++ 0"
; ," 8 # # *6" #" "
0 # * 20 J+) * %&' ( ! CC
$ &

0 # ; # G " )/ ! ;# # 0 #
) 0E # $ # ) 0E

."H # 00 2 ( ## ( ## ( ##
' # G D ." # # 8 # G * # 8 #

0 # 0 #
) 0E ) 0E

0 # * J0*
( ## + ( ##
*
' # #0 # 8 # 00 8 #
G " #
keulkeul.blogspot.com

; # ;# #
# $ #
8 "#* ) #
8 "#* ) #
1 "* G *
%&' ( ! CL
$ &

; # " "## $ #,0 *" X


*" 0 # ( $
9 0#" 0 # * H # " #
; $ , * $$ * *" 2 *
( " # # # * 20 G " )/ ! ; # $
# 0 *" 0 E# 0/ # * 2 "
( " # # # * 20 ;# $ #
0 *" 0 E# 0/ # * * 4
; *6" " " 0 " $$ 2 *
keulkeul.blogspot.com

; ## 2 * # * "
( ## # * $$ # 0/ # # A"#."6, * 7 7
" 00 , ' #) 4 * #0 #
( ## " # # 0/ # # ' #) 4 #0 # ) 0
%&' ( ! CM
$ $

5 "4 00 / ## 40 #0 " " " "


," 0 # %&' 20 J++ 0" " J+) *
" # " " " )/ ! ;# " ;# *
# *" 0 # %&'
<html:inputText onchange="submit()" value="#{databean.name}"
valueChangeListener="#{databean.inputChangement}" />

;6 " " )/ ! ;# 0 # "


/ * 00 # # # * /

" # " # * ) 8 " )/ ! ;# "


;# * # 0# *" 0 # %&'
keulkeul.blogspot.com

<html:inputText onchange="submit()" value="#{databean.name}" >


<core:valueChangeListener type="beanPackage.InputTextChangeListener" />
</html>

) ## " / * ." #
00 # # # * / %&' ( ! C
$ $

5 # # * "4 #< $ " $ " # / * # ." #


00 # # *" * / * # " "#
5 # #* 6 " " / * * H $ " * #
0" )/ ! 0 E 20
*6 , G " )/ ! 8 " 8
5 # #* # " ## 0 6 $
G " )/ ! ;# " ;# * H $ "
."’ # 0 ## ."’" "# # ." #
keulkeul.blogspot.com

* # " # *" 0 è # 0 " 0é # $ #


* # # #…
84 0 #0 " / " * #é " "#…
%&' ( ! CN
$ ( $

; # # ## # " / ! * " #
* / # ." * " " *6" 0 # # *$ #
" # * ." 0 # * * /
;6 # # # * 20 G " )/ ! 8
J+) 0 ! ) 0 # "
A ! DG " " " "
A ! *G " " 6 "
K
( # " " " * 20 G " )/ ! ;#
0 6 " " )/ ! ;# # " # " / *
keulkeul.blogspot.com

0 # " )/ ! ;# # " # " ##


+ 0 * 6 $ G " )/ ! ;#
*0 ##G " )/ ! G " )/ ! 8 / * ."
/ ! * " %&' ( ! CR
$ ( $

84 0 " = " >


<html:form>
<p>
<html:outputText value="Veuillez saisir votre nom : " />
<html:inputText onchange="submit()" value="#{databean.name}"
valueChangeListener="#{databean.inputChangement}" />
</p>
<p>
<html:outputText value="Choisissez votre périphérique : " />
<html:selectOneMenu onchange="submit()" value="#{databean.oneMenuValue}"
valueChangeListener="#{databean.selectChangement}">
<core:selectItems value="#{databean.manyCheckBoxItems}" />
</html:selectOneMenu>
</p>
</html:form>

" )/ ! ;# " A#0


keulkeul.blogspot.com

*" 0 A

%&' ( ! L
$ ( $

84 0 #" " = " >


public class DataBean {
private String menuValue;

private String name= "";


...

public void inputChangement(ValueChangeEvent event) {


System.out.println("InputText");
System.out.println(event.getOldValue());
System.out.println(event.getNewValue());
System.out.println(event.getComponent().getClass());
}
public void selectChangement(ValueChangeEvent event) {
System.out.println("SelectOneMenu");
System.out.println(event.getOldValue());
System.out.println(event.getNewValue());
System.out.println(event.getComponent().getClass());
keulkeul.blogspot.com

}
}

5 A
*" 0 A
%&' ( ! L
$ ( $

84 0 " = # >
<html:form>
<p>
<html:outputText value="Veuillez saisir votre nom : " />
<html:inputText onchange="submit()" value="#{databean.name}" >
<core:valueChangeListener type="beanPackage.InputTextChangeListener"/>
</html:inputText>
</p>

<p>
<html:outputText value="Choisissez votre périphérique : " />
<html:selectOneMenu onchange="submit()" value="#{databean.oneMenuValue}" >
<core:valueChangeListener type="beanPackage.SelectOneMenuListener" />
<core:selectItems value="#{databean.manyCheckBoxItems}" />
</html:selectOneMenu>
</p>
</html:form>
keulkeul.blogspot.com

" )/ ! ;# : ! A#0
*" 0 A

%&' ( ! L
$ ( $

84 0 #" " = # >


public class InputTextChangeListener implements ValueChangeListener {
public void processValueChange(ValueChangeEvent event) throws
AbortProcessingException {
System.out.println("InputText");
System.out.println(event.getOldValue());
System.out.println(event.getNewValue());
System.out.println(event.getComponent().getClass());
}
}

& "; # A + 0" : 4 )/ ! ; # A


*" 0 A *" 0 A
keulkeul.blogspot.com

public class SelectOneMenuListener implements ValueChangeListener {


public void processValueChange(ValueChangeEvent event) throws
AbortProcessingException {
System.out.println("SelectOneMenu");
}
}

%&' ( ! L3
$ ( $

84 0 " = # > " = " >


<html:form> " )/ ! ; # : ! # A#0 *"
<p>
<html:outputText value="Veuillez saisir votre nom : " /> 0 A
<html:inputText onchange="submit()" value="#{mixdatabean.name}"
valueChangeListener="#{mixdatabean.inputChangement}" />
</p>
<p>
<html:outputText value="Choisissez votre périphérique : " />
<html:selectOneMenu onchange="submit()" value="#{mixdatabean.oneMenuValue}" >
<core:valueChangeListener type="beanPackage.DataBeanBis" />
<core:selectItems value="#{mixdatabean.manyCheckBoxItems}" />
</html:selectOneMenu>
</p>
public class DataBeanBis implements ValueChangeListener {
</html:form>
...
public void inputChangement(ValueChangeEvent event) {
System.out.println("InputText");
System.out.println(event.getOldValue());
keulkeul.blogspot.com

System.out.println(event.getNewValue());
System.out.println(event.getComponent().getClass());
}
5 #A public void processValueChange(ValueChangeEvent event) throws
*" 0 A AbortProcessingException {
System.out.println("SelectOneMenu");
}
}
%&' ( ! LC
$

; # # ## # "4 ## * / #
." ** # ." # #" * # " # "* # ## # #

;6 # # # * 20 8
J+) 0 ! ) 0 # "

( # " " " * 20 ;#


0 6 " ;# # " # " / *
keulkeul.blogspot.com

0 # ;# # " # " ##

+ 0 * 6 $ ;#
*0 ## 8 / * ." 6
%&' ( ! LL
$

84 0 ." # # # "
<html:form>
<h1><html:outputText value="Quatre Saisons ... " /></h1> ;# " A#0
<html:panelGrid columns="2" >
*" 0 A
<html:commandButton disabled="false" value="Hivers" id="Hivers"
binding="#{saisonbean.hivers}" actionListener="#{saisonbean.traiterHivers}"/>

<html:commandButton disabled="true" value="Printemps" id="Printemps"


binding="#{saisonbean.printemps}" actionListener="#{saisonbean.traiterPrintemps}"/>

<html:commandButton disabled="true" value="Eté" id="Ete"


binding="#{saisonbean.ete}" actionListener="#{saisonbean.traiterEteAutomne}"/>

<html:commandButton disabled="true" value="Automne" id="Automne"


binding="#{saisonbean.automne}" actionListener="#{saisonbean.traiterEteAutomne}" />

</html:panelGrid>
</html:form>
keulkeul.blogspot.com

%&' ( ! LM
$

84 0 #" ." # # # "


public class SaisonBean {
public void traiterHivers(ActionEvent e) {
& # A
hivers.setDisabled(true); *" 0 A
printemps.setDisabled(false);
}
public void traiterPrintemps(ActionEvent e) {
printemps.setDisabled(true);
ete.setDisabled(false);
}
public void traiterEteAutomne(ActionEvent e) {
String id = e.getComponent().getId();
if (id.equals("Ete")) {
automne.setDisabled(false);
ete.setDisabled(true);
}

if (id.equals("Automne")) {
automne.setDisabled(true);
keulkeul.blogspot.com

hivers.setDisabled(false);
}
}
public HtmlCommandButton getAutomne() { return automne; }
public void setAutomne(HtmlCommandButton automne) { this.automne = automne; }
...
}

%&' ( ! L
$

84 0 * # # 0 #
<html:form> ;# : ! A#0 *" 0 A
<h1><html:outputText value="Des liens ..." /></h1>
<html:commandLink value="Confirmer" id="confirmer">
<core:actionListener type="beanPackage.ActionBean" />
</html:commandLink>
<html:commandLink value="Annuler" id="annuler">
<core:actionListener type="beanPackage.ActionBean" />
</html:commandLink>
</html:form>

public class ActionBean implements ActionListener {


public void processAction(ActionEvent event) throws AbortProcessingException {
String id = event.getComponent().getId();

if (id.equals("confirmer")) {
System.out.println("Action Confirmation");
keulkeul.blogspot.com

if (id.equals("annuler")) {
System.out.println("Action Annulation");
}
} A *" 0 A
}

%&' ( ! LN
$

00 # 0 # * * / * # #
* # 2 * %&'
G " )/ ! 8 0 E# 0/ # * 2 "
8 0 E# 0/ # * 4

: " $ #< # é ## * 0 " *é / #


é é # A"# 0 è# 0/ # 4 &7
( " ." < ." # ’ é H * *é / * #é é #
é* c
keulkeul.blogspot.com

5é / #é é # *’" 0 # "# #é é
#* # " # 0 # #
«) " " » 0 ##"# * 2 * 0 " *é# "0 #
# * * # " # 0 # #
%&' ( ! LR
$

8 * #
G " )/ ! 8 * ;# # $ #
) # G * 0" # #
G " )/ ! ;# # $ # 0 # 0 #
) 0E ) 0E

."H # 00 2 ( ## ( ## ( ##
' # G D ." # # 8 # G * # 8 #

0 # 0 #
) 0E ) 0E

0 # * J0*
( ## + ( ##
keulkeul.blogspot.com

*
' # #0 # 8 # 00 8 #
G " #

8 "#* ) #
8 "#* ) #
1 "* G * %&' ( ! M
$

( " * / * # # * < $ "


*$ " * 6 " * , "
& " 0 # * # # ," * / *
# * # é #é # 0 è# 0/ # 4 &
7 "
# G " )/ ! ;# # #" *é /é#
2 * " # 0 ! ## 0/ # 2 "
( " # 00 00 40 à * #0 # * ' #) 4
& " 0 # * * à " *é / é*
# ;# # *é /é#
keulkeul.blogspot.com

2 * # " " é 00 0 à * #0 #
' #) 4
+ # à ." * # *éAà é é é* #
0 «) # * #* é #» %&' ( ! M
$

84 0 / ! * # # # * K

8 * * !

& * " *
# " ## < / 0 : 0/
$ *6" " * # #
keulkeul.blogspot.com

& / ! * #
0 # & "
6 " * , " <
* 6 # 0 # $$ " %&' ( ! M
$

84 0 #" / ! * # # # *
<core:view>
<core:loadBundle basename="EventMessages" var="bundle" />
<html:form>
<p>
<html:outputText value="#{bundle.PHONE_NUMBER_MESSAGE}"/>
<html:inputText id="priceId" value="#{selectimmediate.phonenumber}" >
<core:validateLength minimum="10" maximum="10"/>
</html:inputText><html:message for="priceId" />
</p>
<p>
<html:outputText value="#{bundle.COUNTRY_MESSAGE}"/>
<html:selectOneMenu onchange="submit()" immediate="true"
valueChangeListener="#{selectimmediate.countryChanged}"
value="#{selectimmediate.countryValue}" >
<core:selectItems value="#{selectimmediate.countryNames}" />
</html:selectOneMenu>
</p>
keulkeul.blogspot.com

<p>
<html:commandButton value="#{bundle.VALID_MESSAGE}"/>
</p>
</html:form> * " A#0 *" 0 A
</core:view>

%&' ( ! M3
$

84 0 #" / ! * # # # *
public class DataBeanSelectImmediate {
private static final String FRENCH_COUNTRY_NAME = "Français";
private static final String ENGLISH_COUNTRY_NAME = "English";

private SelectItem[] countryNames = new SelectItem[] {


new SelectItem(FRENCH_COUNTRY_NAME),
new SelectItem(ENGLISH_COUNTRY_NAME)
};
5 & + * A
public void countryChanged(ValueChangeEvent e) { *" 0 A
System.out.println("DataBeanSelectImmediate.countryChanged()");
FacesContext current = FacesContext.getCurrentInstance();
if (FRENCH_COUNTRY_NAME.equals(e.getNewValue())) {
current.getViewRoot().setLocale(Locale.FRENCH);
} else {
current.getViewRoot().setLocale(Locale.ENGLISH);
}
current.renderResponse();
}
keulkeul.blogspot.com

8 ## ! #W$ 0 0 # *" 0 A
) " " 2 * 0 "
00 40 0 # # PHONE_NUMBER_MESSAGE = Téléphone
" # 0 # # %&' 0 # * COUNTRY_MESSAGE = Pays
VALID_MESSAGE = Valider
# *
%&' ( ! MC
$ &

0 E# / ." 0/ # *" 2 * %&'< * #


#* 20 (/ # 8 # * / #

;6 0 " H " # * 0/ # # * *é !" !

; * # (/ # 8 # # 0 " A *
20 (/ # ; #

;6 # $ $ / * $ !" %&'
* * ## ." 0 (/ # ; #
keulkeul.blogspot.com

*$ *" $ / $ # $! 4
A " # Z $ 2 [ # "# # Z0/ # # [

( # * ## * 20 (/ # ; #
%&' ( ! ML
$ &

8 (/ # 8
! ' #) 4 " 6 # *" ' #) 4 0 "
."H "#*
! (/ # +* " 6+5 * 0/ # *" 2 * "#*

8 " " (/ # ; #
$ (/ # (/ # 8 00 ." *" 0/ # *" 2 * #

$ (/ # (/ # 8 00 * ! *6" 0/ #
*" 2 *
keulkeul.blogspot.com

(/ # +* ! (/ # +* " " A (/ # +* 0
*6 * $ # , 0/ #

; ## (/ # +* * $ " # * # #0
*6 * $ # * $$ # 0/ # # *" 2 %&'* ( ! MM
$ &

84 0 # #* " # # 0/ # #
<faces-config>
... $ # $ ! 4 *" 0 A
<lifecycle>
<phase-listener>beanPackage.LifeCycleListener</phase-listener>
</lifecycle>
</faces-config>
public class LifeCycleListener implements PhaseListener {

public void afterPhase(PhaseEvent phaseEvent) {


System.out.println("LifeCycleListener.afterPhase()" +
phaseEvent.getPhaseId());
}
public void beforePhase(PhaseEvent phaseEvent) {
System.out.println("LifeCycleListener.beforePhase()" +
phaseEvent.getPhaseId());
}
public PhaseId getPhaseId() {
return PhaseId.ANY_PHASE;
}
keulkeul.blogspot.com

; $ )2 ;# A *" 0 A

%&' ( ! M
4 ( ' ( )*

; #0 $ %&' * " # * 0 # # ."


0 # " 0 0 / 2' #
) # 0 # ## , -" # E# # " "

0 / * $ " /E." : / D *
- A $ # *- A " * #$ # #"00 #
/ 0 11 2$ # 0 / !1 / D
) /E." $ "
5 # 0 # # ! 0/ ." # 4 # ,/
5 # 0 # #$ # 4 # ,
keulkeul.blogspot.com

5 # * # 4 $ =' $ >
8 0 # *- " # / # # (1

* ## *6 4 0 # ( CC &9 ( $C $

/ 0 11DDD 1 2$ # %&' ( ! MN
4 ( ' ( )* $ (

%&) "
: = >
( 0"0
keulkeul.blogspot.com

: *( ) *

%&' ( ! MR
4 ( ' ( )* $ ( A B

84 * *5 :

9 8*
keulkeul.blogspot.com

5 &
: :
%&' ( !
4 ( ' ( )* $ ( A B

( ! & / *"

( !
keulkeul.blogspot.com

%&' ( !
4 ( ' ( )* "

: / D $ " ! * # * # 0 #
, "4 $ " # 0 #0 $ %&'
* ) * ) *
( " * " " * * *
( * / # ." 0 4< # < # *< * #
* J
( " * " J ;
* 8
( " * " * ## ."
keulkeul.blogspot.com

* !840
( " * * # 40 ## # !" E #
<html:inputText id="regExprValue" value="#{validateForm.regExpr}" required="true">
<t:validateRegExpr pattern='\d{5}'/>
</html:inputText>
%&' ( !
4 ( ' ( )*

0 / : / D 6 # 0 "# # ."6" *
#
& * , 6 * ## / 0 11 2$ # 0 / !1* D *
: / ! 6 / / D 444 ?0
5 0 ## * # 0 78 + '1 * 6 00
D
+ 0 # # #0 # # #* : / D
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
keulkeul.blogspot.com

J # # # #* / 4K
<html:inputText id="regExprValue" value="#{validateForm.regExpr}" required="true">
<t:validateRegExpr pattern='\d{5}'/>
</html:inputText>

%&' ( ! 3
00 $ * …
U #" 0 * 0 # #0 # # #
# #0 # # #< * *" 0 # < *"
84 0 / E *" K
keulkeul.blogspot.com

%&' ( ! C
0

( E # 0 ## # *6" K
J 0 ## ." 6 # 0 # "## = # "0 > ." & " #
; * #0 * #0 $ * %&' *" " #
" # #" " 0 " 0 * $ *" 2 *
# "0# * " 6 00 / 0 0 # # 0 # *6"
2 * ." = " >
; # " #< ! " #< # "# 8 0# * ." # 0 " "4
" # *" 0 "! # / 0 11 ## " $ ! A0
; # / # # "* #< 0 / K
: = # >< = # #0 0 # # #0 "
keulkeul.blogspot.com

* > 0" # = 0 # 0 # # >


) 0 $* # " #0 " ! *" %&' =0 # >e
=( 0 $ > ## " #* # 4 0 # # * $$"#
; #' # #2# E * 0 0 " %&' %&' ( ! L

You might also like