Bonjour à tous,

Je viens de débuter le développement d'un site à base de myfaces/tomahawk mais la validation tomahawk ne fonctionne pas.

voici le fichier validate.jsf

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
<f:view>
 
   <f:loadBundle basename="org.proforma.ressource.bundle" var="labelText"/>
 
    <h:panelGroup id="body">
 
        <t:messages showDetail="true" showSummary="false"/>
 
        <h:form id="form1">
            <h:panelGrid columns="3">
 
                <h:outputLabel for="email" value="#{labelText.emailContact}"/>
                <h:inputText id="email" value="#{organismeForm.emailContact}" required="true">
                    <f:validator validatorId="org.apache.myfaces.validator.Email"/>
                </h:inputText>
                <t:message id="emailError" for="email" styleClass="error"/>
 
                <h:outputLabel for="email2" value="#{labelText.emailOrganisme}"/>
                <h:inputText id="email2" value="#{organismeForm.emailOrganisme}" required="true">
                    <t:validateEmail detailMessage="Not a valid email address."/>
                </h:inputText>
                <t:message id="emailError2" for="email2" styleClass="error"/>
 
                <h:outputLabel for="passwd" value="#{labelText.passwd}"/>
                <h:inputText id="passwd" value="#{organismeForm.passwd}" required="true"/>
                <t:message id="passwdError" for="passwd" styleClass="error"/>
 
                <h:outputLabel for="passwdConfirm" value="#{labelText.passwdConfirm}"/>
                <h:inputText id="passwdConfirm" value="#{organismeForm.passwdConfirm}" required="true">
                    <t:validateEqual for="passwd"
                                     summaryMessage='#{"Value {0} should equal {1}"}'
                                     detailMessage='#{"The value of this field, {0}, should equal the value of that other field, {1}"}'/>
                </h:inputText>
                <t:message id="equal2Error" for="passwdConfirm" styleClass="error"/>
 
                <h:panelGroup/>
                <h:commandButton id="validateButton" value="#{labelText.orgFormButtonLabel}"
                                 action="#{organismeForm.submit}"/>
                <h:panelGroup/>
 
            </h:panelGrid>
        </h:form>
 
    </h:panelGroup>
 
 
</f:view>
et voici le code du bean:
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
59
package org.proforma.bean;
 
import javax.faces.context.FacesContext;
import javax.faces.application.FacesMessage;
import javax.faces.validator.ValidatorException;
import javax.faces.component.UIComponent;
 
public class OrganismeForm {
 
	private String emailContact = null;
	private String emailOrganisme = null;
	private String passwd = null;
	private String passwdConfirm = null;
 
 
 
    public String getEmailContact(){
    	return emailContact;
    }
 
    public void setEmailContact(String emailContact){
    	this.emailContact = emailContact;
    } 
 
 
    public String getEmailOrganisme(){
    	return emailOrganisme;
    }
 
    public void setEmailOrganisme(String emailOrganisme){
    	this.emailOrganisme = emailOrganisme;
    }
 
 
    public String getPasswd(){
    	return passwd;
    }
 
    public void setPasswd(String passwd){
    	this.passwd = passwd;
    }
 
    public String getPasswdConfirm(){
    	return passwdConfirm;
    }
 
    public void setPasswdConfirm(String passwdConfirm){
    	this.passwdConfirm = passwdConfirm;
    }  
 
 
    	public String submit(){
		System.out.println("Action was called.");
		return ("valid");
	}
 
 
 
}
Toutes les validations de tomahawk ne fonctionnent pas alors que cet exemple est entièrement copié du package d'exemples de tomahawk.
j'utilise myfaces 1.2.2 et tomahawk 1.1.6.

Pour un début c'est quand même frustrant

De l'aide SVP, merci