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 :

Redierction d'une page JSP vers une autre


Sujet :

Servlets/JSP Java

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    87
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Juin 2008
    Messages : 87
    Points : 48
    Points
    48
    Par défaut Redierction d'une page JSP vers une autre
    salut tt le monde
    g une page jsp "resultat.jsp" ki contient un boutton retour vars la page "modifNote.jsp".
    Quand je clique sur le boutton g c deux erreurs
    "org.apache.jasper.JasperException: null" et "java.lang.NumberFormatException: null".
    Je pense que c du à la recuperation de la valeur de "Matiere".

    voila le code de la page "resultat.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
    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
     
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <%@ page import="java.util.* , java.sql.*" %>
    <!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>
    <jsp:useBean id="bean" scope="session" class="projet.enseignant.Etudiant">
    </jsp:useBean>
     
    <form name="fo" action="modifNote.jsp" method="get">
    <table bgcolor="#33CCFF" style="border-color:#000066" style="border-bottom-style:inset" border="1">
     
    <tr>
    <th>Nom et Prenom</th>
    <th><input type="hidden" value="IdEtudiant"></th>
    <th>Controle1</th>
    <th>Controle2</th>
    <th>Controle3</th>
    <th>Assiduité</th>
    <th>TP</th>
    <th>Exam</th>
    <th>Rattrapage</th>
    <th>Moyenne</th>
    <th>Décision</th>
    </tr>
     
    <%
    float nt=0;
    float moy=0;
    float som=0;
    String dec="";
    int []tb={10,10,10,10,10,50,50};
     
    String var=request.getParameter("ouf");
    final int mat=Integer.parseInt(var);
    String ch=bean.etud(mat);
     
    String url = "jdbc:odbc:li";
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection x = DriverManager.getConnection(url, "sa", "adminadmin");
    Connection x1 = DriverManager.getConnection(url, "sa", "adminadmin");
    Statement s = x.createStatement();
    Statement s1 = x1.createStatement();
    ResultSet r = s.executeQuery(""+ch);
    ResultSet r1;
     
    while(r.next()){
            float tab[] = {0,0,0,0,0,0,0};
            int ide=r.getInt(1);
            String nom=r.getString(2);
            String pren=r.getString(3);
            for(int i=1;i<8;i++){
                    String res="SELECT Note " +
                    "FROM NoteControleMatiere " +
                    "WHERE IdMatiere='"+ mat +"' "+
                    "AND IdEtudiant='"+ ide +"' "+
                    "AND IdControle='"+ i +"' ";
                    r1=s1.executeQuery(""+res);
                    while(r1.next())
                            tab[i-1]=r1.getFloat(1);
            }
            moy=bean.Moyenne(ide, mat);
            dec=bean.decision(moy);
    %>
    	<tr>
    	<td><%=nom %> <%=pren %></td>
    	<td><input type="hidden" value="<%=ide %>" > </td>
    	<%
            for(int j=0;j<=6;j++){  
                    nt=tab[j];
            %>
    		<td><input type="text" size="10" value="<%=nt %>"></td> 
    	<%
            }
            %>
    	<td><%=moy %></td>
    	<td><%=dec %></td>
    	</tr>
    <%
    }
    %>
    </table>
    <input type="submit" value="retour" onclick="document.fo.submit(); document.fo.action='modifNote.jsp?Matiere=<%=mat%>'; ">
    </form>
    </body>
    </html>
    voila le code de la page "modifNote.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
    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
     
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <%@ page import="java.util.* , java.sql.*" %>
    <!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>
    <jsp:useBean id="bean" scope="session" class="projet.enseignant.Etudiant">
    </jsp:useBean>
     
    <form name="f" action="fonctions.jsp" method="get">
    <table bgcolor="#33CCFF" style="border-color:#000066" style="border-bottom-style:inset" border="1">
     
    <tr>
    <th>Nom et Prenom</th>
    <th><input type="hidden" value="IdEtudiant"></th>
    <th>Controle1</th>
    <th>Controle2</th>
    <th>Controle3</th>
    <th>Assiduité</th>
    <th>TP</th>
    <th>Exam</th>
    <th>Rattrapage</th>
    </tr>
     
    <%
    float nt=0;
     
    String var=request.getParameter("Matiere");
    final int mat=Integer.parseInt(var);
    String ch=bean.etud(mat);
     
    String url = "jdbc:odbc:li";
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection x = DriverManager.getConnection(url, "sa", "adminadmin");
    Connection x1 = DriverManager.getConnection(url, "sa", "adminadmin");
    Statement s = x.createStatement();
    Statement s1 = x1.createStatement();
    ResultSet r = s.executeQuery(""+ch);
    ResultSet r1;
     
    while(r.next()){
            float tab[] = {0,0,0,0,0,0,0};
            int ide=r.getInt(1);
            String nom=r.getString(2);
            String pren=r.getString(3);
            for(int i=1;i<8;i++){
                    String res="SELECT Note " +
                    "FROM NoteControleMatiere " +
                    "WHERE IdMatiere='"+ mat +"' "+
                    "AND IdEtudiant='"+ ide +"' "+
                    "AND IdControle='"+ i +"' ";
                    r1=s1.executeQuery(""+res);
                    while(r1.next())
                            tab[i-1]=r1.getFloat(1);
            }
            
    %>
    	<tr>
    	<td><%=nom %> <%=pren %></td>
    	<td><input type="hidden" value="<%=ide %>" > </td>
    	<%
            for(int j=0;j<=6;j++){  
                    nt=tab[j];
            %>
    		<td><input type="text" size="10" value="<%=nt %>"></td> 
    	<%
            }
            %>
     
    	</tr>
    <%
    }
    %>
    </table>
     
    <input type="hidden" name="ouf" value="<%=mat %>">
    <input type="submit" value="retour" onclick="document.f.submit(); document.f.action='fonctions.jsp'; ">
    <input type="submit" value="calculer moyenne" onclick="document.f.submit(); document.f.method='post'; document.f.action='resultat.jsp'; ">
    </form>
    </body>
    </html>
    aidez moi
    MErci beaucoup d'avance.

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    87
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Juin 2008
    Messages : 87
    Points : 48
    Points
    48
    Par défaut Redirection de JSP a JSP
    RE
    g reussit a resoudre le truc.
    voila ce ke g fait
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <input type="submit" value="retour" onclick="document.fo.submit(); document.fo.method='post'; document.fo.action='modifNote.jsp?Matiere=<%=mat %>'; ">
    merci a vous comme meme.

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

Discussions similaires

  1. Rédirection d'une page JSP vers une autre page JSP
    Par demcoul dans le forum Servlets/JSP
    Réponses: 0
    Dernier message: 13/03/2014, 14h26
  2. Réécriture de l'URL pour passer d'une page JSP vers une autre
    Par meriem meryoma dans le forum Servlets/JSP
    Réponses: 1
    Dernier message: 20/04/2013, 08h53
  3. Réponses: 0
    Dernier message: 04/08/2010, 14h02
  4. Redirigé une page html vers une page php
    Par Invité dans le forum Balisage (X)HTML et validation W3C
    Réponses: 1
    Dernier message: 15/08/2006, 12h24
  5. diriger une page web vers une page php
    Par moonia dans le forum Langage
    Réponses: 7
    Dernier message: 11/04/2006, 11h41

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