Redierction d'une page JSP vers une autre
salut tt le monde :P
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:
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:
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 :roll:
MErci beaucoup d'avance.:king: