Etat HTTP 500 - An exception occurred processing JSP page :org.apache.jasper.JasperException
Bonjour, je suis débutante en JEE et j'ai rencontré l'exception "org.apache.jasper.JasperException"
pouvez vous m'aidez pour résoudre ce problème ?
Citation:
type: Rapport d''exception
message: An exception occurred processing JSP page /produit.jsp at line 56
description: Le serveur a rencontré une erreur interne qui l''a empêché de satisfaire la requête.
exception:
org.apache.jasper.JasperException: An exception occurred processing JSP page /produit.jsp at line 56
53: <th>Etat</th>
54: </tr>
55: <%
56: Iterator<Produit>list=produits.getList().iterator();
57: while (list.hasNext())
58: {
59: Produit p= list.next();
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
cause mère :
java.lang.NullPointerException
org.apache.jsp.produit_jsp._jspService(produit_jsp.java:122)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
et voici le code :
Citation:
<%@page import="java.util.Iterator"%>
<%@page import="web.ProduitBeans"%>
<%@page import="metier.Produit"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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>Gestion des produits</title>
</head>
<body>
<%
ProduitBeans produits = (ProduitBeans) request
.getAttribute("modele");
%>
<h3>Tutoriel JEE (servlet, MVS, JDBC, JSP)</h3>
<h5>Ajouter un nouveau produit</h5>
<form action="prodserv" method="post">
<table border="1" width="30%">
<tr>
<td>Nom</td>
<td><input type="text" name="nom" /></td>
</tr>
<tr>
<td>Description</td>
<td><input type="text" name="desc" /></td>
</tr>
<tr>
<td>Prix</td>
<td><input type="text" name="prix" /></td>
</tr>
<tr>
<td>Etat</td>
<td><input type="text" name="etat" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="valider" /></td>
</tr>
</table>
</form>
<table border="1" width="60%">
<tr>
<th>ID</th>
<th>Nom</th>
<th>Description</th>
<th>Prix</th>
<th>Etat</th>
</tr>
<%
Iterator<Produit>list=produits.getList().iterator(); //ligne d'erreur
while (list.hasNext())
{
Produit p= list.next();
%>
<tr>
<td><%=p.getId() %></td>
<td><%=p.getNom() %></td>
<td><%=p.getDesc()%></td>
<td><%=p.getPrix() %></td>
<td><%=p.getEtat() %></td>
</tr>
<% } %>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>