Bonjour,

J'ai un problème dans l’affichage d'une variable qui a été chargée avec RichFaces.

La page.jsp
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
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<f:view>
<h:form>
date_arrive:<rich:calendar value="#{R.r.date_arrive}" required="false" style="width: 244px"  cellWidth="18px" cellHeight="16px" datePattern="MMM d, yyyy"/><br>
date_depart:<rich:calendar value="#{R.r.date_depart}" required="false" style="width: 244px"  cellWidth="18px" cellHeight="16px" datePattern="MMM d, yyyy"/> />**MMM d, yyyy<br>
<h:selectOneMenu style="width: 225px" value="#{R.r.categorie}"> 
<f:selectItem itemValue ="A" />
 <f:selectItem itemValue ="B" />
  <f:selectItem itemValue ="C" /> 
  <f:selectItem itemValue ="suite" /> 
   </h:selectOneMenu>
   code carte:<h:inputText value="#{R.r.code_carte}" style="width: 244px" /><br>
 
   <a4j:commandButton styleClass="Button" value="réserver" action="#{R.verifier(R.r.date_arrive,R.r.date_depart,R.r.categorie)}"  reRender="rep">
<a4j:actionparam name="username" value="#{R.r.code_carte}" assignTo="#{R.num_client}" />
</a4j:commandButton>
 
</h:form>
</f:view>
</body>
</html>
La classe Java
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
private int num_client;
 
    public int getNum_client() {
            return num_client;
        }
 
        public void setNum_client(int num_client) {
            this.num_client = num_client;
        }
 
    public String verifier(Date date_arrive , Date date_depart , String categorie){
             String x="echec";
            try
            {System.out.println("1");
                                         .
                                         .
                                         .
 
                System.out.println(getNum_client());
                                session.getTransaction().commit();
            }
            catch(Exception i)
            {
                System.out.println("Error");
            }
            return x;
        }
La sortie en console donne ceci :
0
Quelqu'un saurait-il m'indiquer pourquoi ça n'affiche que '0' ?

Merci d'avance pour votre aide.