Bonjour,
J'ai un problème d'affichage avec ma JSP
Voici ce que je fais:
Le problème, c'est que ca n'affiche pas mes out.printl("");
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 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ page import="org.apache.poi.hssf.usermodel.HSSFSheet, "%> <%@ page import="org.apache.poi.hssf.usermodel.HSSFWorkbook"%> <%@ page import="org.apache.poi.hssf.usermodel.HSSFCell"%> <%@ page import="org.apache.poi.hssf.usermodel.HSSFRow"%> <%@ page import="org.apache.poi.poifs.filesystem.POIFSFileSystem" %> <%@ page import="java.io.*" %> <%@ 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"%> <!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>Excel.jsp</title> </head> <body> <% String name=request.getParameter("file");//on récupère le chemin du fichier%> <% //Colonne du fichier 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")); HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFSheet sheet = wb.getSheetAt(0); HSSFRow row = null; HSSFCell cell = null; //double totalLigne = 0.0; //double totalGeneral = 0.0; 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){ out.println(jours+" jours"); num=row.getRowNum(); num++; out.println("n° de la ligne : "+num); //System.out.println("Today is " +dat1 ); //System.out.println("ON AFFICHE LA LIGNE !!!"); 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(); 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); } } out.println(name); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } %> Successfully created file. </body> </html>
J'ai du mal comprendre qlqchose...
Partager