IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Servlets/JSP Java Discussion :

Mes beans ne sont pas reconnus dans la JSP


Sujet :

Servlets/JSP Java

  1. #1
    Membre averti
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2011
    Messages
    593
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Juin 2011
    Messages : 593
    Points : 353
    Points
    353
    Par défaut Mes beans ne sont pas reconnus dans la JSP
    Salut tout le monde!

    J'ai le code suivant dans ma JSP:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    <jsp:useBean id="${utilisateur}" class="beans.Utilisateur" 
                         scope="session">            
            </jsp:useBean>
     
                <div class="panel_connecter">
                    ${utilisateur.login};
                    ${utilisateur.pwd};
                </div>
    Et dans mon contrôleur:
    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
     
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            String forward = null;
     
            String action = request.getParameter("action");
            if (action.equals("connexion")){
                forward = authentification(request);
            }
            RequestDispatcher requestDispatcher = request.getRequestDispatcher(forward);
            requestDispatcher.forward(request, response);
        }
     
    private String authentification(HttpServletRequest request){
            String forward = null;
     
            String login = request.getParameter("login");
            String pwd = request.getParameter("pwd");
     
            Utilisateur utilisateur;
            try {
                utilisateur = utilisateurService.authentification(login, pwd);
                if (utilisateur == null){
                    forward = "jsp/authentification.jsp";
                    request.getSession().setAttribute("utilisateur", utilisateur);
                }else{
                    forward = "jsp/trombinoscope.jsp";
                }
            } catch (SQLException ex) {
                Logger.getLogger(GlobalController.class.getName()).log(Level.SEVERE, null, ex);
            }   
            return forward;
        }
    Lorsque j'exécute j'obtiens l'erreur suivante:
    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
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
     
    org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    ';' expected
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    not a statement
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    ';' expected
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    illegal start of expression
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    not a statement
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    ';' expected
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    not a statement
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    ';' expected
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    illegal start of expression
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    ')' expected
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    not a statement
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    ';' expected
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    illegal start of expression
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    ';' expected
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    not a statement
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    ';' expected
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    not a statement
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    ';' expected
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    illegal start of expression
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    ')' expected
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    not a statement
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    ';' expected
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    illegal start of expression
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    not a statement
     
    PWC6197: An error occurred at line: 17 in the jsp file: /jsp/trombinoscope.jsp
    PWC6199: Generated servlet error:
    ';' expected
     
    PWC6199: Generated servlet error:
    'try' without 'catch' or 'finally'
     
    PWC6199: Generated servlet error:
    illegal start of type
     
    PWC6199: Generated servlet error:
    illegal start of type
     
    PWC6199: Generated servlet error:
    ';' expected
     
    PWC6199: Generated servlet error:
    <identifier> expected
     
    PWC6199: Generated servlet error:
    <identifier> expected
     
    PWC6199: Generated servlet error:
    class, interface, or enum expected
    Ceci est dû à quoi? comment corriger?

    Merci!

  2. #2
    Membre averti
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2011
    Messages
    593
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Juin 2011
    Messages : 593
    Points : 353
    Points
    353
    Par défaut
    J'ai enlevé la balise <jsp:useBean> et là ça marche
    Par contre, ${utilisateur.login} et ${utilisateur.pwd} sont vides.
    Je me suis trompée où?

  3. #3
    Membre confirmé
    Avatar de drieu13
    Homme Profil pro
    Développeur Java
    Inscrit en
    Avril 2009
    Messages
    131
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Vienne (Limousin)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2009
    Messages : 131
    Points : 469
    Points
    469
    Par défaut
    A mon avis tu ne dois pas enlever la balise <jsp:useBean> car c'est elle qui définit ton bean.
    Je pense qu'il te manque la balise <jsp:setProperty> pour remplir ton bean.
    Essaye de rajouter la balise <jsp:setProperty> :

    <jsp:useBean id="user" class="beans.Utilisateur" scope="session"/>
    <jsp:setProperty name="user" property="*"/>

  4. #4
    Membre averti
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2011
    Messages
    593
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Juin 2011
    Messages : 593
    Points : 353
    Points
    353
    Par défaut
    Ah ça marche, merci beaucoup!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Mes requêtes nommées ne sont pas trouvées dans mon war
    Par ploxien dans le forum Hibernate
    Réponses: 1
    Dernier message: 25/02/2009, 13h54
  2. mes _FK ne sont pas persistés dans ma base oracle
    Par mickael.guilbert dans le forum JPA
    Réponses: 4
    Dernier message: 08/02/2008, 11h01
  3. Réponses: 26
    Dernier message: 05/02/2007, 16h57
  4. Mes DVD R+ (W) ne sont pas reconnus
    Par Speed41 dans le forum Périphériques
    Réponses: 10
    Dernier message: 29/12/2006, 11h34

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo