Voila je voudrais valider un formulaire cote client grace a Validator.
Tout fonctionne mise a part que les messages d erreurs ne sont pas affichees. Quand je laisse login ou password vide il se contente de recharger la page....
Je vois pas ou est mon erreur alors si quelqun a une idee...
Merci d avance
validation.xml:
ressource.properties:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN" "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd"> <form-validation> <formset> <!-- Validation pour le formulaire d'authentification --> <form name="authentificationbean"> <field property="login" depends="required"> <arg0 key="personne.authentification.login.vide"/> </field> <field property="password" depends="required"> <arg0 key="personne.authentification.password.vide"/> </field> </form> </formset> </form-validation>
formulaire:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 errors.header=<ul> errors.footer=</ul> personne.authentification.login.vide=<font color="red"><li>Nom d'utilisateur manquant</li></font> personne.authentification.password.vide=<font color="red"><li>Mot de passe manquant</li></font>
Struts-config.xml:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <html> <meta http-equiv="pragma" content="no-cache"> <head> <title>Personne - authentification</title> </head> <body> <center> <table width="100%" align="center" valign="center"> <tr> <td width="10%"> <img src="/srv/vues/images/logo-emn.gif"> </td> <td align="center"> <h2><font color="navy">Système de réservation des véhicules de l'EMN</font></h2> </td> <td width="10%"> </td> </tr> </table> <hr> <br> <br> <br> <html:form action="/authentification"> <table> <tr> <td align="center"><font color="navy">Nom d'utilisateur</font></td> <td align="center"><html:text property="login" size="20" style="color: navy"/></td> </tr> <tr> <td align="center"><font color="navy">Mot de passe</font></td> <td align="center"><html:password property="password" size="20" style="color: navy"/></td> </tr> <tr> </table> <table> <tr> <td><html:submit value="Login" style="color: navy"/></td> </tr> </table> <table height="80"> <tr> <td width=300 height=80 align=center><html:errors/></td> </tr> </table> <br> <br> <table border=1 cellspacing=0 cellpadding=20> <tr> <td height=20 align=center><font color="navy" size="2">Ce site est optimisé pour une utilisation en 1024*768 avec les navigateurs Mozilla 1.7, FireFox, Netscape 7.0 et Internet Explorer 6.0</font></td> </tr> </table> </html:form> </center> </body> </html>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> <struts-config> <form-beans> <form-bean name="authentificationbean" type="beans.AuthentificationBean"/> <form-bean name="reservationbean" type="beans.ReservationBean"/> <form-bean name="substitutbean" type="beans.SubstitutBean"/> <form-bean name="vehiculebean" type="beans.VehiculeBean"/> </form-beans> //action-mapping... <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> <set-property value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" property="pathnames"/> </plug-in> </struts-config>
Partager