Bonjour,

Je developpe une application JSP et je rencontre un problème de taille : Lorsque l'un de mes utilisateurs se connecte, il s'identifie et il a accès à ses données sans problèmes. Mais si un deuxième se connecte, avant d'avoir à s'identifier, il est reconnu comme étant le premier utilisateur (et du coup il a acces a toutes les données qui ne lui sont pas adressées). S'il se log, il fait se terminer la session du premier utilisateur.

En clair : ma gestion des utilisateur, ne permet qu'à un utilisateur à la fois de se connecter.

Je vous met le code que 'ai utilisé pour récupérer l'utilisateur identifié :

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 errorPage = "/WEB-INF/erreur.jsp" import="bd.*" %>
 <%@ include file = "/WEB-INF/jspf/navigation.jspf" %>
 
 <jsp:useBean id="identificat" class="bd.Personne" scope="session" >
     <jsp:setProperty name="identificat" property="*" />
 
     <h3 align="center">
 
     <%
         if (identificat.existe()) {
     %>
     <font color="green">Utilisateur authentifié : Docteur 
     <jsp:getProperty name="identificat" property="nom" /></font>   
        <br><META HTTP-EQUIV="Refresh" CONTENT="3, URL=reception.jsp">
     Veuillez patienter quelques secondes, vous allez être redirigé vers votre messagerie ... :
     <br>
     Si la redirection ne s'est pas faites dans 5 s veuillez cliquer <a href="bienvenue.jsp"> ICI </a> .
     <% 
             }else{
     %>
     <font color="red">Nom d'utilisateur ou mot de passe incorrects !</font>  
     <META HTTP-EQUIV="Refresh" CONTENT="2, URL=identification.jsp">
     <% 
        session.removeAttribute("identificat");
             }
             identificat.arrêt();
     %>
 
 
 </jsp:useBean>
 <%@ include file = "/WEB-INF/jspf/pieds.jspf" %>
Et celui que j'utilise pour définir l'utilisateur connecté (ce code c'est un .jspf donc normal si il n'y a pas toutes les balises) :

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
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
 
 
   <%! int idPer = 0; %>
 <%! String identité = "A tout le monde"; %>
     <%! String ff = "demi"; %>
 <% 
     Personne opérateur = (Personne) session.getAttribute("identificat");
     if (opérateur!=null) {
         String temp = opérateur.getId();
         idPer = Integer.parseInt(temp);
         identité = "Docteur "+opérateur.getPrénom()+" "+opérateur.getNom();
         ff = opérateur.getFormat();
     }
     
 %>   
 
<html>
  <head><title>Messages</title></head>
  <body bgcolor="#E0E0E0" >
    <font face="Comic Sans MS">
        <br>
         <table border="0" bgcolor="#E0E0E0" cellpadding="3" cellspacing="2" align="center" width="91%">
  <tr>   
  <th align="left"><input type="image" src="new30.PNG" border="0" ></th>
       <th>
 
 
                 <td align="right"><iframe width=174 height=189 name="gToday:normal:agenda.js:gfFlat_arrDate" id="gToday:normal:agenda.js:gfFlat_arrDate" src="Classic/iflateng.htm" scrolling="no" frameborder="0">
                 </iframe>
       </th>
             </tr>
         </table>
 
 
        <table border="1" bgcolor="1" cellpadding="3" cellspacing="2" width="90%" align="center">
            <tr bgcolor="#99CCFF">         
            <th align="left"><a href="reception.jsp">R&eacute;ception</a></th>
            <th align="left"><a href="bienvenue.jsp">Emission</a></th>
            <th align="left"><a href="archive.jsp">Archives</a></th>
            <!--<th align="left"><a href="planning.jsp">Agenda</a></th>-->
            <th align="right">
                <a href="identification.jsp">Identification</a>
              <a href="deconnexion.jsp" target="wclose" onclick="window.open('deconnexion.jsp','wclose','width=800,height=600, toolbar=no, status=no, left=20, top=30')"></a>
            </th>
            </th> 
            </tr>
        </table>
        <table width="90%" align="center">
            <tr>
                <th align="left"><%= identité %></th>
                 <th align="left"></th>
                <th align="right"><%= request.getRemoteHost() %></th>
            </tr>
        </table>
    </font><font face="arial">
J'espere que certains d'entre vous y verrons clair dans cette histoire.

Bonne journée à tous.