bonjour , je travail mon projet avec jsp , je veux exécuter la requête
select * from Materiel where CODEP=?
je veux afficher le materiel qui corespond à un CODEP (code du poste comptable qui contient plusieur materiel) dans la page des poste j'ai fait un lien à coté de chaque poste qui mène vers la page des matériel, et quand je clique sur ce lien ça me donne
org.apache.jasper.JasperException:java.lang.NullPointerException
voila le lien
<a href="http://localhost:8080/Stage/listMateriel.jsp?CODEP=<%=rs.getString(1) %>">Show</a>
et dans la page des matériels :
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
|
<%!ResultSet rs=null;%>
<%try{ Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:azerty","administrateur", "admin");
PreparedStatement sStat=con.prepareStatement("select* from MATERIEL where CODEP=?");
String codep=request.getParameter("CODEP") ;
sStat.setString(1, codep);
ResultSet rs=sStat.executeQuery();
}catch(Exception e){JOptionPane.showMessageDialog(null,e.getMessage());}%>
<table border="1" cellpadding="1">
<thead>
<tr>
<th>Code materiel</th>
<th>Code fournisseur</th>
<th>Code Poste</th>
<th>Code fourn rmpl</th>
<th>Code type</th>
<th>N°inventaire</th>
<th>Designation</th>
<th>Etat</th>
<th>Date Stock</th>
<th>Date Livraison</th>
<th>Date Remplacement</th>
</tr>
</thead>
<%
while(rs.next()){
%>
<tbody>
<tr>
<td><%=rs.getString(1)%></td>
<td><%=rs.getString(2)%></td>
<td><%=rs.getString(3)%></td>
<td><%=rs.getString(4)%></td>
<td><%=rs.getString(5)%></td>
<td><%=rs.getString(6)%></td>
<td><%=rs.getString(7)%></td>
<td><%=rs.getString(8)%></td>
<td><%=rs.getString(9)%></td>
<td><%=rs.getString(10)%></td>
<td><%=rs.getString(11)%></td>
</tr>
<%
}
%> |
je sais pourquoi ça me donne cette erreur si quelqu'un peux m'aider s'il vous plais. est ce que je dois utiliser une servlets ??
Partager