Professional Documents
Culture Documents
0164 Formation JSF
0164 Formation JSF
" # $
) (
( ! * #) * #+ # , -+* ."
'
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
& 0 $ * #* $ #* # F "# * # #
keulkeul.blogspot.com
) $"# * # #
& "# # #* #$ " # $ A#0 # F "#
$ * * $$ # J ;6#
%&' " # # H # #0 " " F "
( ## * $ #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
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 ( %
J # * # 0 # # %&'
* # # 0 ! # %&(
; # 0 # # %&' # 40 # #
"4 %&(# ! V "4 # #0 # #é# %&' ( !
9
) # " $ " * #" 0 ! %&( " # #
# # %&'
5 00 " ." $$ " " = 00 ! > #
" # *" $ "
3 *$ $ " 0 " #0 $ 6 6 ## "
M ) # 0 ! # %&( #0 * , / ." * *
"
( ! # 0 ! # %&( " # #0 4 %&' * $ P
, *62 * * %&' ( !
2
## $ !" *" $ / ) 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
/ 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
D 4
%&' ( ! L
9$ 1 6 $ 2
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$ # $! /
<faces-config>
<navigation-rule>
...
5 # 0 * $
</navigation-rule>
* 6 00 %&'
<managed-bean>
...
keulkeul.blogspot.com
</managed-bean>
</faces-config>
+-
( '
%&' ( ! R
9$ 2
; # #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$ '
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"%>
<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>
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>
84 0 #" $$ / ## ! = 9 7 *>K
) #* # ." 0 ! D %&' A#0 $ ."
## " # * * # # 0 ## 0 & 0 0
keulkeul.blogspot.com
84 0 #" $$ / ## ! = 9 7 *>K
) #* # ." ## " D %&' A#0 $ ."
## " # * * # # 0 ## 0 & 0 0
keulkeul.blogspot.com
%&' ( ! M
6 =< >
84 0 #" $$ / ## ! = 9 7 *>K
<faces-config>
</faces-config>
keulkeul.blogspot.com
$ # $!4
6 9$ *" 0 A
: <
1$ $
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, ...
classes Beans
<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 +:^[
$ A#0 *" 0 A
! $ 0
%&' ( ! 3
0 $ 2# 0 6 $ $ A B
J 8; 0 *6 * # 0 "4 # * # * $$ #
# 0 #* 6 00 0 ! < ." # < # ## 00
#{expression}
_` 40 ## a
; * 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
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
0 A # A#0 *"
0 A ; 5
%&' ( ! 3M
0 $ 9 C 99 ( 0
return password;
}
public void setPassword(String t) {
this.password = t;
}
}
%&' ( ! 3N
0 $ 9 C 99 ( 0
$ A#0 *" 0 A
! $ 0
$$ / ! * "
*6 # *"
%&' ( ! 3R
0 $ 9 C 99 ( 0
<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
<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
<property-name>prices</property-name>
<map-entries>
<map-entrie>
<key>SwimmingPool High Pressure</key>
<value>250</value>
</map-entrie>
</map-entries>
%&' ( ! C3
0 $ 0
<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
& $
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
$ 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 {
return "Accepted";
} 9
} 9 :
9
) A "
*" 0 A : $ %&' ( ! L3
: $ & 6
<managed-bean-class>
beanPackage.BeanController2 $ # $ ! 4 *"
</managed-bean-class> 0 A : $
...
</faces-config>
%&' ( ! LC
: $ & 6
</body> ,
</html> / * ! )
$ A#0 *" 0 A
: $
%&' ( ! LL
: $ & 6
</html>
( ! $$ / , #" *
# " ## ; " *
0 0 *"
* $ 0
%&' ( ! LM
$ (
## # ." 0 0 #) # #G * #
; # # #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 #
! 0/ ." # "# #* # * # 4 0 #
"
* ## 0 " " # * * #
* * ## 0 " " * * * #
." * " " ! <$ # " 0 %&' ( ! MC
$ ( <'!
#? *-" / 0* 4
#2 $ *" # 2
! * $ * # ." * " # "
K " "0 0 # *- " #K %&' ( ! ML
$ ( <'!
; # / 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>
%&' ( ! MN
$ ( F( ' H
; 0 # Z/ * : [0 * #" # * #
* # #" 0 "# " # # 0 "# " # ! #
; 0 " H " # ." * *- #,
$$ / # "
; #* # 0 *E 0 " H ! #0 * #
#
"#* #
" " * * # 2< ; # < #" & < K
* , , 0" 0 " / ." !
keulkeul.blogspot.com
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; }
%&' ( !
$ ( 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
$ # ."- 2 * ! # * $ *-" $
84 0
& * $ #" D) ## #]^ D < D < D ^
0 *" $ D < D < D < D < D <K
%&' ( ! C
$ ( F( ' H
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 "4 "#* # # +
5 # 0 * # 0 " # * # # " # " ."
5# * "0 # -
" " ." 0 #" A & +
; 4 , $$ /
G " " " "# "
J A & + # 40 * * #"
5 $$ # # " "#
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>
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; #
} "
}
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
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 * #
$ # ## #
Q" 0 " * $ A c
84 ) 4 é* "4 é é #* ."H * é0 #
G D é* à * - * # 0 # # J+G D
*$ *é " *" 2 * 0 é é
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());
$ # 4 A#0
*" 0 A
6
keulkeul.blogspot.com
%&' ( ! NR
0 * $
! A#0
*" 0 A
J " 0 * $0
J " * #"
0 # 4 J "
keulkeul.blogspot.com
* #
; " / ! # #
0 ## 0 %&' ( ! R
0 * $
} ! 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
%&' ( ! RL
! $ 99 ( $
; /E." 9: ; 0 0 # * "4 # #0 # # #
0 " $$ / # ## ! #
Z/ ## ! #[ $$ / "# # ## ! #
Z/ ## ! [ $$ / # ## ! # ## #," ** 0 #
; # # # # " # #" #
$ * ." 6 * *" 0 # " ." 0 " ## !
#/ D5 ." 0 # # ## ! # *
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; }
## ! # *"
0 A ! $ %&' ( ! R
! $ 99 ( $
<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"%>
## ! 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;
%&' ( !
! $
<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
<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 *
%&' ( !
&
* é 0 7 7 6
3 & # é / "é< # * é 0 #*
/ ! * 0 ! * # ## ! # *- " # !é é é#
* é 0 7 7 6
N
%&' ( !
&
,
J (
1 9
%&' ( ! R
& A J42 B
;- 0é * - $ G " 9 * * $ " * #
0 0 é é# 0 "
8$$ " # " A )
& " 0 - A )
(
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 " #
0/ # 2
: " 0 " "0
# " # ." ##" #
* #0 E #
%&' ( !
& A J42 B
( ##"# * # 0 - (+
#" *G " # 0 ! # A K # * #
G " # 4 0 * ! # A K H *" 0 ##"#
*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
return price;
}
public void setPrice(double pPrice) {
this.price = pPrice;
}
}
) *"
0 A %&' ( ! C
$ :
# 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
</core:view>
</body>
</html>
%&' ( !
$ '
public BeanConverter2() {
tickets = 50;
name = "Mon Nom";
date = new Date();
}
) A
*" 0 A
%&' ( ! N
$
...
<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
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
...
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
."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
" &
G 0 # 0 " *é * #" …
6
#
A $ #
B & 9
%&' ( ! 3
" & A 42 B
; # 0 # # 0 - $ 8* G " 9 *
0 " 40 * #G * # J++ 0"
J A G * $ " " é/ *
* ' #) 4 < J+) 0 0 < A "
keulkeul.blogspot.com
/ D# G * 84 0 / ! *’ $$ " *
J # ## * *# $ " #
* 5 " ! * #* #* 20 5 "
* ; ! ! * #* #* 20 ; !
* ; !/ * !" " * 20 + !
4 " " 4
" "
* ! " " # *" * ." #
%&' ( ! 33
"
</html:form>
...
# * * * A#0 *"
0 A "
%&' ( ! 3C
"
J # * 6 " *
00 # ." # 0 * * #
." # 0 # #* 20 J++ 0" %&' ( ! 3L
"
;’ 4 0 0 *’ * ." # * #’ # 0 #
keulkeul.blogspot.com
0 ##é
& 4 0 *é /é < " *é 00 " à 0 * / !
# ## ! # à " ’ A ' #) 4
%&' ( ! 3M
"
%&' ( ! 3
"
84 0 " # * # Z * [
public class PersoValidator implements Validator {
public void validate(FacesContext fc, UIComponent comp, Object ref)
throws ValidatorException {
String myValue = null;
}
}
} ... $ # $!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 # 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;
}
myValue = ref.toString();
keulkeul.blogspot.com
%&' ( ! C
"
0 # " * A#0
keulkeul.blogspot.com
*" 0 A "
%&' ( ! C
"
( " F …
8 " * # #0 0 # # #0 " # *
keulkeul.blogspot.com
%&' ( ! C3
$ $
5 # A #0 " * # #
) # * # " "# # # ! #
; # *6 # # $ * #" *6
" # " " " "
;6 (+ %&' $ " * "4 20 # *6 #
keulkeul.blogspot.com
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
$ &
; ## 2 * # * "
( ## # * $$ # 0/ # # A"#."6, * 7 7
" 00 , ' #) 4 * #0 #
( ## " # # 0/ # # ' #) 4 #0 # ) 0
%&' ( ! CM
$ $
) ## " / * ." #
00 # # # * / %&' ( ! C
$ $
; # # ## # " / ! * " #
* / # ." * " " *6" 0 # # *$ #
" # * ." 0 # * * /
;6 # # # * 20 G " )/ ! 8
J+) 0 ! ) 0 # "
A ! DG " " " "
A ! *G " " 6 "
K
( # " " " * 20 G " )/ ! ;#
0 6 " " )/ ! ;# # " # " / *
keulkeul.blogspot.com
*" 0 A
%&' ( ! L
$ ( $
}
}
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
$ ( $
%&' ( ! L3
$ ( $
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 # "
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:panelGrid>
</html:form>
keulkeul.blogspot.com
%&' ( ! LM
$
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>
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
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
$
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";
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
$ &
; * # (/ # 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 {
; $ )2 ;# A *" 0 A
%&' ( ! M
4 ( ' ( )*
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