IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Servlets/JSP Java Discussion :

Erreur "org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP"


Sujet :

Servlets/JSP Java

  1. #1
    Membre averti Avatar de mouss4rs
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    884
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 884
    Points : 355
    Points
    355
    Par défaut Erreur "org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP"
    Bonjour,

    J'ai cette erreur-ci:

    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
    Etat HTTP 500 - 
     
    --------------------------------------------------------------------------------
     
    type Rapport d''exception
     
    message 
     
    description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.
     
    exception 
     
    org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP: 
     
    An error occurred at line: 15 in the generated java file
    Syntax error on token "import", Identifier expected after this token
     
    Stacktrace:
    	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
    	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
    	org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
    	org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
    	org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
    	org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
    	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    	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:722)
     
     
    note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/7.0.23.
     
     
    --------------------------------------------------------------------------------
     
    Apache Tomcat/7.0.23
    J'essaye de lire un fichier avec la librairie POI et de l'afficher dans un tableau comme ceci:
    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
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    <%@page import="java.io.*"%>
    <%@page import="java.util.*"%>
    <%@page import=" org.apache.poi.hssf.usermodel.HSSFSheet"%>
    <%@page import=" org.apache.poi.hssf.usermodel.HSSFWorkbook"%>
    <%@page import=" org.apache.poi.hssf.usermodel.HSSFRow"%>
    <%@page import=" org.apache.poi.hssf.usermodel.HSSFCell"%>
    <%@page import="java.io.FileInputStream"%>
    <%@page import="java.io.FileNotFoundException"%>
    <%@page import="java.io.IOException"%>
    <%@page import="java.text.DateFormat"%>
    <%@page import="java.text.ParseException"%>
    <%@page import="java.text.SimpleDateFormat"%>
    <%@page import="java.util.Calendar"%>
    <%@page import="java.util.Iterator"%>
     
     
    <form>
    <% 
    String type_dossier;
    String ref_presta;
    String code_action;
    long N_BP_Symphonie;
    String Indice_Carat;
    String lib_offre;
    String entite;
    String televendeur;
    String recu = "" ;
    String expedie ="";
    String date_npai;
    String anomalie;
    Calendar cal1=Calendar.getInstance();
    Calendar cal2=Calendar.getInstance();
               
            try{
                    //POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("IETD_export2.xls"));
                    FileInputStream fs =new FileInputStream("IETD_export.xls");
                  HSSFWorkbook wb = new HSSFWorkbook(fs);
                  HSSFSheet sheet = wb.getSheetAt(0);
                  HSSFRow row = null;
                  HSSFCell cell = null;
                  int numLigne = 1;
                  int n;
                  int num;
                  DateFormat formatter ; 
                  java.util.Date dat1 ; 
                  java.util.Date dat2 ; 
                  formatter = new SimpleDateFormat("dd/MM/yyyy");
                  for (Iterator rowIt = sheet.rowIterator(); rowIt.hasNext();){
                      //totalLigne = 0;
                      row = (HSSFRow)rowIt.next();
                      //nbre total de ligne
                      n = row.getRowNum();
                 
                      //test pour eviter de lire les entetes
                      if(n!=0){
                      
                      recu = row.getCell(8).getStringCellValue();
                      expedie = row.getCell(9).getStringCellValue();
                     
                      //test pour eviter que l'une des dates soit vides et avoir un parse error de la date
                      if(recu!="" && expedie!=""){
                      dat1 = formatter.parse(recu);
                      dat2 = formatter.parse(expedie);
                      cal1.setTime(dat1);
                      cal2.setTime(dat2);
                      //System.out.println("-----"+cal1.toString());
                      
                      int jours = 0;
                      while (cal1.before(cal2)){
                       cal1.add(Calendar.DAY_OF_MONTH,1);
                       jours++;
                      }
                      
                      //TEST
                      if(jours>2){
                            //System.out.println(jours+" jours");
                            %>
    	          	<input type="text" name="jours" value="<%=jours%>">
    	          		<%
                            num=row.getRowNum();
                            num++;
                            //System.out.println("n° de la ligne : "+num);
                            %>
    	          	<input type="text" name="nligne" value="<%=num%>">
    	          		<%
                          //System.out.println("Today is " +dat1 );
                            //System.out.println("ON AFFICHE LA LIGNE !!!");
                            %>
    	          	<table>
    	          	<tr><td>type_dossier</td><td>référence prestataire</td><td>code action</td><td>N_BP_Symphonie</td><td>Indice_Carat</td><td>lib_offre</td><td>entite</td>
    	          	<td>televendeur</td><td>recu</td><td>expedie</td><td>date_npai</td><td>anomalie</td></tr>
     
    	          		<%
                            //System.out.println("type_dossier|référence prestataire|code action      |N_BP_Symphonie     " +
                                            //"|Indice_Carat|lib_offre|entite|televendeur|recu|expedie|date_npai|anomalie");
                            
                            type_dossier = row.getCell(0).getStringCellValue();
                            ref_presta = row.getCell(1).getStringCellValue();
                            code_action = row.getCell(2).getStringCellValue();
                            N_BP_Symphonie = (long) row.getCell(3).getNumericCellValue();
                            Indice_Carat = row.getCell(4).getStringCellValue();
                            lib_offre = row.getCell(5).getStringCellValue();
                            entite = row.getCell(6).getStringCellValue();
                            televendeur = row.getCell(7).getStringCellValue();
                            //
                            date_npai = row.getCell(10).getStringCellValue();
                            anomalie = row.getCell(11).getStringCellValue();
                            %>
    	          	<tr><td><%=type_dossier %></td><td><%=ref_presta %></td><td><%=code_action %></td><td><%=N_BP_Symphonie %></td><td><%=Indice_Carat %></td><td><%=lib_offre %></td><td><%=entite %></td>
    	          	<td><%=televendeur %></td><td><%=recu %></td><td><%=expedie %></td><td><%=date_npai %></td><td><%=anomalie %></td></tr>
    	          	</table>
    	          	<%
                          //System.out.println(type_dossier+"          "+ref_presta+"       "+code_action+"         "+N_BP_Symphonie+"        "+Indice_Carat+"                   "+lib_offre+"    "+entite+"  "+televendeur+"  "+recu+"  "+expedie+"   "+"   "+date_npai+"  "+"   "+anomalie);      
                      }
                      
                      for (Iterator cellIt = row.cellIterator(); cellIt.hasNext();) {
                            cell = (HSSFCell) cellIt.next();
                            //System.out.println("ligne n° "+cell.getRowIndex());//avoir le numéro de ligne
                            break;
                      }
                      //System.out.println("total ligne "+numLigne+" = "+totalLigne);
                      //totalGeneral += totalLigne;
                      numLigne++;
                    }
                    //System.out.println("total general "+totalGeneral);
                    //System.out.println("fini");
                    //System.out.println("Nbre de ligne lue: "+numLigne);
                    }
                    }
                  
                  } catch (FileNotFoundException e) {
                    e.printStackTrace();
                  } catch (IOException e) {
                    e.printStackTrace();
                  }
                  
    %>
    </form>
    Quelqu'un a-t-il déja réussi à afficher le contenu d'un fichier excel dans un tableau ?

  2. #2
    Membre averti Avatar de florentB
    Homme Profil pro
    Développeur Java
    Inscrit en
    Décembre 2006
    Messages
    332
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Décembre 2006
    Messages : 332
    Points : 441
    Points
    441
    Par défaut
    question bête :
    c'est une erreur de copier-coller l'espace après les quotes ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <%@page import=" org.apache.poi.hssf.usermodel.HSSFWorkbook"%>
     <%@page import=" org.apache.poi.hssf.usermodel.HSSFRow"%> 
    <%@page import=" org.apache.poi.hssf.usermodel.HSSFCell"%>
    Je suis pas sûr qu'il comprenne. Essaie d'enlever l'espace

  3. #3
    Membre averti Avatar de mouss4rs
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    884
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 884
    Points : 355
    Points
    355
    Par défaut
    Maintenant, quand j'appuie sur le bouton valider, j'ai aucun tableau d'afficher dans ma jsp.
    Rien sauf le titre 'Extraction IETD' au début.

    Y'a qlq chose que j'ai pas vraiment compris...

    revoici 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
    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
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    <%@page import="java.io.*"%>
    <%@page import="java.util.*"%>
    <%@page import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
    <%@page import="org.apache.poi.hssf.usermodel.HSSFWorkbook"%>
    <%@page import="org.apache.poi.hssf.usermodel.HSSFRow"%>
    <%@page import="org.apache.poi.hssf.usermodel.HSSFCell"%>
    <%@page import="org.apache.poi.poifs.filesystem.POIFSFileSystem" %>
    <%@page import="java.io.FileInputStream"%>
    <%@page import="java.io.FileNotFoundException"%>
    <%@page import="java.io.IOException"%>
    <%@page import="java.text.DateFormat"%>
    <%@page import="java.text.ParseException"%>
    <%@page import="java.text.SimpleDateFormat"%>
    <%@page import="java.util.Calendar"%>
    <%@page import="java.util.Iterator"%>
    <html><head><title>Extraction du Fichier Excel</title>
    <link rel="stylesheet" type="text/css" href="style_de_base.css" media="screen">
    </head>
    <body>
    <center><h3>Extraction IETD</h3>
    <br>
    </center>
     
    <form>
    <% 
    String type_dossier;
    String ref_presta;
    String code_action;
    long N_BP_Symphonie;
    String Indice_Carat;
    String lib_offre;
    String entite;
    String televendeur;
    String recu = "" ;
    String expedie ="";
    String date_npai;
    String anomalie;
    Calendar cal1=Calendar.getInstance();
    Calendar cal2=Calendar.getInstance();
               
            try{
                    POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("IETD_export.xls"));
                    //FileInputStream fs =new FileInputStream("C:/IETD_export.xls");
                  HSSFWorkbook wb = new HSSFWorkbook(fs);
                  HSSFSheet sheet = wb.getSheetAt(0);
                  HSSFRow row = null;
                  HSSFCell cell = null;
                  int numLigne = 1;
                  int n;
                  int num;
                  DateFormat formatter ; 
                  java.util.Date dat1 ; 
                  java.util.Date dat2 ; 
                  formatter = new SimpleDateFormat("dd/MM/yyyy");
                  for (Iterator rowIt = sheet.rowIterator(); rowIt.hasNext();){
                      //totalLigne = 0;
                      row = (HSSFRow)rowIt.next();
                      //nbre total de ligne
                      n = row.getRowNum();
                 
                      //test pour eviter de lire les entetes
                      if(n!=0){
                      
                      recu = row.getCell(8).getStringCellValue();
                      expedie = row.getCell(9).getStringCellValue();
                     
                      //test pour eviter que l'une des dates soit vides et avoir un parse error de la date
                      if(recu!="" && expedie!=""){
                      dat1 = formatter.parse(recu);
                      dat2 = formatter.parse(expedie);
                      cal1.setTime(dat1);
                      cal2.setTime(dat2);
                      //System.out.println("-----"+cal1.toString());
                      
                      int jours = 0;
                      while (cal1.before(cal2)){
                       cal1.add(Calendar.DAY_OF_MONTH,1);
                       jours++;
                      }
                      
                      //TEST
                      if(jours>2){
                            //System.out.println(jours+" jours");
                            %>
    	          	<input type="text" name="jours" value="<%=jours%>">
    	          		<%
                            num=row.getRowNum();
                            num++;
                            //System.out.println("n° de la ligne : "+num);
                            %>
    	          	<input type="text" name="nligne" value="<%=num%>">
    	          		<%
                          //System.out.println("Today is " +dat1 );
                            //System.out.println("ON AFFICHE LA LIGNE !!!");
                            %>
    	          	<table>
    	          	<tr><td>type_dossier</td><td>référence prestataire</td><td>code action</td><td>N_BP_Symphonie</td><td>Indice_Carat</td><td>lib_offre</td><td>entite</td>
    	          	<td>televendeur</td><td>recu</td><td>expedie</td><td>date_npai</td><td>anomalie</td></tr>
     
    	          		<%
                            //System.out.println("type_dossier|référence prestataire|code action      |N_BP_Symphonie     " +
                                            //"|Indice_Carat|lib_offre|entite|televendeur|recu|expedie|date_npai|anomalie");
                            
                            type_dossier = row.getCell(0).getStringCellValue();
                            ref_presta = row.getCell(1).getStringCellValue();
                            code_action = row.getCell(2).getStringCellValue();
                            N_BP_Symphonie = (long) row.getCell(3).getNumericCellValue();
                            Indice_Carat = row.getCell(4).getStringCellValue();
                            lib_offre = row.getCell(5).getStringCellValue();
                            entite = row.getCell(6).getStringCellValue();
                            televendeur = row.getCell(7).getStringCellValue();
                            //
                            date_npai = row.getCell(10).getStringCellValue();
                            anomalie = row.getCell(11).getStringCellValue();
                            %>
    	          	<tr><td><%=type_dossier %></td><td><%=ref_presta %></td><td><%=code_action %></td><td><%=N_BP_Symphonie %></td><td><%=Indice_Carat %></td><td><%=lib_offre %></td><td><%=entite %></td>
    	          	<td><%=televendeur %></td><td><%=recu %></td><td><%=expedie %></td><td><%=date_npai %></td><td><%=anomalie %></td></tr>
    	          	</table>
    	          	<%
                          //System.out.println(type_dossier+"          "+ref_presta+"       "+code_action+"         "+N_BP_Symphonie+"        "+Indice_Carat+"                   "+lib_offre+"    "+entite+"  "+televendeur+"  "+recu+"  "+expedie+"   "+"   "+date_npai+"  "+"   "+anomalie);      
                      }
                      
                      for (Iterator cellIt = row.cellIterator(); cellIt.hasNext();) {
                            cell = (HSSFCell) cellIt.next();
                            //System.out.println("ligne n° "+cell.getRowIndex());//avoir le numéro de ligne
                            break;
                      }
                      //System.out.println("total ligne "+numLigne+" = "+totalLigne);
                      //totalGeneral += totalLigne;
                      numLigne++;
                    }
                    //System.out.println("total general "+totalGeneral);
                    //System.out.println("fini");
                    //System.out.println("Nbre de ligne lue: "+numLigne);
                    }
                    }
                  
                  } catch (FileNotFoundException e) {
                    e.printStackTrace();
                  } catch (IOException e) {
                    e.printStackTrace();
                  }
                  
    %>
    </form>
    </body></html>

  4. #4
    Membre averti Avatar de mouss4rs
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    884
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 884
    Points : 355
    Points
    355
    Par défaut
    C'est un problème de nullpointerexception que j'ai découvert recemment.

    voici mon nouveau post concernant ce pb
    lien

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 8
    Dernier message: 06/01/2013, 10h55
  2. Réponses: 2
    Dernier message: 25/11/2010, 01h31
  3. Réponses: 1
    Dernier message: 07/10/2009, 12h29
  4. Réponses: 11
    Dernier message: 07/01/2009, 12h59
  5. Réponses: 1
    Dernier message: 02/02/2008, 13h54

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo