Bonjour,
je ne sais pas si c'est ici que je dois poster cette question mais comme problème désigne la servlet jsp, je me demandais si vous m'apportez vos lumières.
juste pour préciser, j'ai quasi la même chose pour une autre entité quizz, et je ne rencontre pas ce genre de problème
j'ai essayé de lancer la requête plus simplejuste pour afficher la liste des question et j'ai une erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3public List<Question> getAllQuestion() { return em.createQuery("select q from Question q").getResultList(); }
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 GRAVE: "Servlet.service()" pour la servlet jsp a lancé une exception javax.el.PropertyNotFoundException: Property 'questionD' not found on type metier.Question at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:214) at javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:191) at javax.el.BeanELResolver.property(BeanELResolver.java:300) at javax.el.BeanELResolver.getValue(BeanELResolver.java:81) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54) at org.apache.el.parser.AstValue.getValue(AstValue.java:123) at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:938) at org.apache.jsp.WEB_002dINF.views.listQuestion_jsp._jspx_meth_c_005fout_005f1(listQuestion_jsp.java:213) at org.apache.jsp.WEB_002dINF.views.listQuestion_jsp._jspx_meth_c_005fforEach_005f0(listQuestion_jsp.java:141) at org.apache.jsp.WEB_002dINF.views.listQuestion_jsp._jspService(listQuestion_jsp.java:93) 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:386) 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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) at web.Application.doListQuestion(Application.java:250) at web.Application.doGet(Application.java:156) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) 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:859) 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) 2 mai 2011 23:42:20 org.apache.catalina.core.StandardWrapperValve invoke
je n'y comprends rien, est ce que c'est au niveau de mon jsp qui manque quelque chose, car quand j'enleve cette ligne le reste s'affiche?
Code : Sélectionner tout - Visualiser dans une fenêtre à part <td><c:out value="${question.questionD}"/></td>mon entité question est :
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 <%@page contentType="text/html;charset=UTF-8"%> <%@page pageEncoding="UTF-8"%> <%@ page session="false" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="core" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> <%@ taglib uri="/WEB-INF/taglibs-datetime.tld" prefix="dt" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <html> <head> <META http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>Question</title> </head> <body> <h2>Liste des Question</h2> <table border="1"> <tr> <th>id</th> <th>question</th> <th>valeur question</th> <th></th> </tr> <c:forEach var="question" items="${questions}"> <tr> <td><c:out value="${question.idQuestion}"/></td> <td><c:out value="${question.questionD}"/></td> <td><c:out value="${question.pointQuestion}"/></td> <td><a href="<c:url value="/do/editReponse?id=-1"/>">Ajouter une reponse</a></td> <td><a href="<c:url value="/do/listReponse?id=${question.idQuestion}"/>">liste des reponses</a></td> <td><a href="<c:url value="/do/editQuestion?id=${question.idQuestion}"/>">Modifier</a></td> <td><a href="<c:url value="/do/deleteQuestion?id=${question.idQuestion}"/>">Supprimer</a></td> </tr> </c:forEach> </table> <br> <a href="<c:url value="/do/editQuestion?id=-1"/>">Ajout Question</a> </body> </html>
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
93
94
95
96
97
98
99 package metier; import java.util.ArrayList; import java.util.Collection; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name="Question") public class Question { @Id @Column(name = "idQuestion", nullable = false) @GeneratedValue(strategy = GenerationType.AUTO) private int idQuestion; @Column(name = "questionD", length = 100, nullable = false) private String questionD; @Column(name = "pointQuestion", length = 5, nullable = false) private int pointQuestion; @ManyToOne @JoinColumn(name = "idQuizz", nullable = false) private Quizz quizz; @OneToMany(cascade=CascadeType.ALL, mappedBy="question") private Collection<Reponse> reponsePropose = new ArrayList<Reponse>(); //constructeurs public Question() {} public Question(String questionD, int pointQuestion, Quizz quizz) { this.questionD=questionD; this.pointQuestion=pointQuestion; this.quizz=quizz; } public int getIdQuestion() { return idQuestion; } public void setIdQuestion(int idQuestion) { this.idQuestion = idQuestion; } public Quizz getQuizz(){ return quizz; } public void setQuizz( Quizz quizz ){ this.quizz = quizz; } public String getQuestion() { return questionD; } public void setQuestion(String questionD) { this.questionD = questionD; } public int getPointQuestion(){ return pointQuestion; } public void setPointQuestion(int pointQuestion){ this.pointQuestion=pointQuestion; } public Collection<Reponse> getReponsePropose(){ return reponsePropose; } public void setReponsePropose(Collection<Reponse> reponsePropose){ this.reponsePropose = reponsePropose; } public void addReponsePropose( Reponse reponsePropose ){ this.getReponsePropose().add( reponsePropose ); reponsePropose.setQuestion(this); } }
Partager