Bonjour, mon histoire d'amour avec les JSP vient de commencer, ou plutôt de rependre.
Sauf que j''ai une erreur dans tomcatvoici ma 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 org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 32 29: if (list != null) nomListL = list.toString(); 30: int i = 0; 31: 32: for (Livre l :list){ 33: %> 34: <tr> 35: <td><%=l.getTitre()%></td> Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
J'ai regardé le poste : http://www.developpez.net/forums/d50...rtir-page-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 <%@ 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>Comamnder un Livre</title> </head> <body> <%@ page import="java.util.*, bean.Livre" %> <%! private String opt1 = "<select name='"; private String opt2 = "'> <option value=0>0</option><option value=1>1</option><option value=2>2</option> <option value=3>3</option> </select>"; %> <div> <FORM action="Connexion" method="get"> <table width="100%"> <TR> <TD><b>Titre</b></TD> <TD><b>Auteur</b></TD> <TD><b>Prix</b></TD> <TD><b>Quantité</b></TD> </TR> <% String nomListL = ""; ArrayList<Livre> list = (ArrayList<Livre>) application.getAttribute("B"); if (list != null) nomListL = list.toString(); int i = 0; for (Livre l :list){ %> <tr> <td><%=l.getTitre()%></td> <td><%=l.getAuteur()%></td> <td><%=l.getPrix()%></td> <td><%=opt1%><%=i++%><%=opt2%></td> </tr> <%} %> </table> <br> <input type="submit" value="Commander"> </FORM> </div> <%@ include file = "footer.html" %> </body> </html>
J'ai essayé de réctifier mon erreur pour tester si je récupére bien qqch...sauf que j'ai toujours la meme erreur.
Sous tomca voila printStack :
Par ailleur j'ai ce warning au niveau de ma 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 18 juin 2011 10:43:13 org.apache.catalina.core.StandardWrapperValve invoke GRAVE: "Servlet.service()" pour la servlet jsp a généré une exception java.lang.NullPointerException at org.apache.jsp.index_jsp._jspService(index_jsp.java:92) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source)
Code : Sélectionner tout - Visualiser dans une fenêtre à part ArrayList<Livre> list = (ArrayList<Livre>) application.getAttribute("B");Ce n'ai pas trop grave car j'envoi bien un arrayList de Livre, donc je sais ce que je récupére.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2- Type safety: Unchecked cast from Object to ArrayList<Livre>
Pour le reste est ce que qqun aurait un conseil à me donner ?
Partager