Bonjour,
Je travaille sur une application JEE, et j'utilise Hibernate + Spring + JSP.
Quand je teste à l'aide de JUnit, tout va bien.
J'aimerais afficher quelques données depuis ma base de données sur ma JSP mais j'obtiens l'erreur suivante :Voilà le code de ma page JSP :Citation:
org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP:
An error occurred at line: 6 in the generated java file
Only a type can be imported. com.FlashInfo.model.TAbonne resolves to a package
Une erreur s'est produite à la ligne: 14 dans le fichier jsp: /listeUtilisateurs.jsp
AbonneService cannot be resolved to a type
11: </head>
12: <body>
13: <% ClassPathXmlApplicationContext context;
14: AbonneService abonneService;
15: context = new ClassPathXmlApplicationContext("application-context.xml");
16: abonneService = (AbonneService) context.getBean("abonneService");
17: List<TAbonne> listeUtilisateurs = abonneService.findAll();
Une erreur s'est produite à la ligne: 16 dans le fichier jsp: /listeUtilisateurs.jsp
AbonneService cannot be resolved to a type
13: <% ClassPathXmlApplicationContext context;
14: AbonneService abonneService;
15: context = new ClassPathXmlApplicationContext("application-context.xml");
16: abonneService = (AbonneService) context.getBean("abonneService");
17: List<TAbonne> listeUtilisateurs = abonneService.findAll();
18:
19: System.out.println("<p>{ \"Utilisateurs\" : [");
Une erreur s'est produite à la ligne: 17 dans le fichier jsp: /listeUtilisateurs.jsp
TAbonne cannot be resolved to a type
14: AbonneService abonneService;
15: context = new ClassPathXmlApplicationContext("application-context.xml");
16: abonneService = (AbonneService) context.getBean("abonneService");
17: List<TAbonne> listeUtilisateurs = abonneService.findAll();
18:
19: System.out.println("<p>{ \"Utilisateurs\" : [");
20: for(int i=0;i<listeUtilisateurs.size();i++)
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
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)
Quelqu'un saurait-il m'indiquer d'où vient le problème ?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 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %> <!DOCTYPE html> <%@ page import="com.FlashInfo.model.TAbonne"%> <%@ page import="org.springframework.context.support.ClassPathXmlApplicationContext"%> <%@ page import="com.FlashInfoWebApp.service.*"%> <%@ page import="java.util.List"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <% ClassPathXmlApplicationContext context; AbonneService abonneService; context = new ClassPathXmlApplicationContext("application-context.xml"); abonneService = (AbonneService) context.getBean("abonneService"); List<TAbonne> listeUtilisateurs = abonneService.findAll(); System.out.println("<p>{ \"Utilisateurs\" : ["); for(int i=0;i<listeUtilisateurs.size();i++) { System.out.println("{\"login\" : \""+listeUtilisateurs.get(i).getLogin()+"\","); System.out.println("\"password\" : \""+listeUtilisateurs.get(i).getPassword()+"\"}"); } System.out.println("]\n}</p>"); %> </body> </html>
Merci d'avance pour votre aide.