bonjour,
j'ai un probleme avec le bouton de validation d'un formulaire avec jsf et primefaces : je dois cliquer deux fois pour voir la reaction
je travaille avec facelet template :
la voici :
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
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <h:outputStylesheet name="style.css" library="css" />
        <h:outputStylesheet name="styleTableExpansion.css" library="css" />
         <ui:insert name="tohead">content</ui:insert>
    </h:head>
    <h:body>
 
        <div id="page">
            <div id="bloc-principal">
                 <h:form prependId="false" id="myform" >
                 <div id="templatemo_header_wrapper">
 
                    <div id="templatemo_header">
 
                        <div id="site_title">
                            <h1>
                                <span>vous etes connect en tant qu' #{userController.u1.nom} mais le newNum #{commmandeController.nouvelId}</span>
                            </h1>
                        </div>
 
                        <ul class="social_network">
                            <li><a id="ident">1dd</a></li>
                            <li><a href="login.xhtml" class="identifiant">on voie celle ci</a></li>
                            <li><a class="identifiant">#{userController.identifiant}2ddd</a></li>
                            <li><h:commandLink action="#{userController.deconnecter}"><h:graphicImage library="images" name="facebook.png" /></h:commandLink></li>
                        </ul>
 
                    </div> <!-- end of templatemo_header -->
                </div> <!-- end of templatemo_header_wrapper -->   
 
                <div id="templatemo_banner_wrapper">
 
                    <div id="templatemo_banner">
 
 
 
                    </div> <!-- end of templatemo_banner -->
 
                </div> <!-- end of templatemo_banner_wrapper -->
 
 
                <div id="templatemo_content_wrapper">
 
                    <div id="templatemo_content">
 
                         <ui:insert name="content">content</ui:insert>
                    </div> <!-- end of templatemo_content -->
                </div> <!-- end of templatemo_content_wrapper -->    
                </h:form>
            </div>
            <div id="templatemo_footer_wrapper">
 
                <div id="templatemo_footer">
 
 
                    <center>
 
                    </center>
 
                </div> <!-- end of footer -->
            </div>
        </div>
 
    </h:body>
</html>
et voila la page ou il y a le probleme sachant que j'ai mis une seule balise <h:form> (comme vous pouvez voir dans le code en haut) pour eviter les problemes :

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
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
 
    <body>
 
        <ui:composition template="./template_admin.xhtml">
            <ui:define name="tohead">             
            </ui:define>
            <ui:define name="content">
 
                <p:panel id="panel" header="New Person">  
 
                    <p:messages id="msgs"/>  
 
                    <h:panelGrid columns="3">  
                        <h:outputLabel for="firstname" value="Firstname: *" />  
                        <p:inputText id="firstname" value="#{addUserController.u2.nom}" required="true" label="Firstname">  
                            <f:validateLength minimum="2" />  
                        </p:inputText>  
                        <p:message for="firstname" display="icon"/>  
 
                        <h:outputLabel for="surname" value="Surname: *" />  
                        <p:inputText id="surname" value="#{addUserController.u2.prenom}" label="Surname" required="true">  
                            <f:validateLength minimum="2" />  
                            <p:ajax update="msgSurname" event="keyup" />  
                        </p:inputText>  
                        <p:message for="surname" id="msgSurname" display="icon"/>  
 
                    </h:panelGrid>  
 
                    <p:commandButton id="btn" value="Save" update="panel" actionListener="#{addUserController.addUser()}"/>  
                </p:panel>  
 
 
            </ui:define>
 
        </ui:composition>
 
    </body>
</html>
et pour le managedBean j'ai essayé les trois cas : @SessionScoped et @ViewScoped et @RequestScoped mais le meme probleme

queqlu'un saurait il comment resoudre le probleme ?

merci d'avance