diff --git a/formation-programmation-java/projets/javaee/movie-db/pom.xml b/formation-programmation-java/projets/javaee/movie-db/pom.xml
index bc6ae69..78247c7 100644
--- a/formation-programmation-java/projets/javaee/movie-db/pom.xml
+++ b/formation-programmation-java/projets/javaee/movie-db/pom.xml
@@ -1,55 +1,61 @@
- 4.0.0
-
- fr.lteconsulting.training
- movie-db
- 1.0-SNAPSHOT
-
- war
-
-
- UTF-8
- UTF-8
-
- 1.8
- 1.8
-
- 11.0.0.Final
-
-
-
-
-
- org.wildfly.bom
- wildfly-javaee7-with-tools
- ${version.wildfly}
- pom
- import
-
-
-
-
-
-
- javax
- javaee-api
- 7.0
- provided
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- 1.8
-
-
-
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
+
+ fr.lteconsulting.training
+ movie-db
+ 1.0-SNAPSHOT
+
+ war
+
+
+ UTF-8
+ UTF-8
+
+ 1.8
+ 1.8
+
+ 11.0.0.Final
+
+
+
+
+
+ org.wildfly.bom
+ wildfly-javaee7-with-tools
+ ${version.wildfly}
+ pom
+ import
+
+
+
+
+
+
+ javax
+ javaee-api
+ 7.0
+ provided
+
+
+
+ org.apache.poi
+ poi
+ 3.17
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.8
+
+
+
+
\ No newline at end of file
diff --git a/formation-programmation-java/projets/javaee/movie-db/src/main/java/fr/lteconsulting/training/moviedb/servlet/ExportServlet.java b/formation-programmation-java/projets/javaee/movie-db/src/main/java/fr/lteconsulting/training/moviedb/servlet/ExportServlet.java
new file mode 100644
index 0000000..12b5b7b
--- /dev/null
+++ b/formation-programmation-java/projets/javaee/movie-db/src/main/java/fr/lteconsulting/training/moviedb/servlet/ExportServlet.java
@@ -0,0 +1,150 @@
+package fr.lteconsulting.training.moviedb.servlet;
+
+import org.apache.poi.hssf.usermodel.HSSFDataFormat;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.*;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+@WebServlet("/export.xls")
+public class ExportServlet extends HttpServlet {
+ private static final String FILENAME = "export.xls";
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ resp.setHeader("Content-disposition", "attachment; filename=" + FILENAME);
+ resp.setHeader("content-type", "application/xls");
+
+ Workbook wb = new HSSFWorkbook();
+ // create a new sheet
+ Sheet s = wb.createSheet();
+ // declare a row object reference
+ Row r = null;
+ // declare a cell object reference
+ Cell c = null;
+ // create 3 cell styles
+ CellStyle cs = wb.createCellStyle();
+ CellStyle cs2 = wb.createCellStyle();
+ CellStyle cs3 = wb.createCellStyle();
+ DataFormat df = wb.createDataFormat();
+ // create 2 fonts objects
+ Font f = wb.createFont();
+ Font f2 = wb.createFont();
+
+ //set font 1 to 12 point type
+ f.setFontHeightInPoints((short) 12);
+ //make it blue
+ f.setColor((short) 0xc);
+ // make it bold
+ //arial is the default font
+ //f.setBoldweight(Font.BOLDWEIGHT_BOLD);
+
+ //set font 2 to 10 point type
+ f2.setFontHeightInPoints((short) 10);
+ //make it red
+ f2.setColor((short) Font.COLOR_RED);
+ //make it bold
+ //f2.setBoldweight(Font.BOLDWEIGHT_BOLD);
+
+ f2.setStrikeout(true);
+
+ //set cell stlye
+ cs.setFont(f);
+ //set the cell format
+ cs.setDataFormat(df.getFormat("#,##0.0"));
+
+ //set a thin border
+ //cs2.setBorderBottom(cs2.BORDER_THIN);
+ //fill w fg fill color
+ //cs2.setFillPattern((short) CellStyle.SOLID_FOREGROUND);
+ //set the cell format to text see DataFormat for a full list
+ cs2.setDataFormat(HSSFDataFormat.getBuiltinFormat("text"));
+
+ // set the font
+ cs2.setFont(f2);
+
+ // set the sheet name in Unicode
+ wb.setSheetName(0, "\u0422\u0435\u0441\u0442\u043E\u0432\u0430\u044F " +
+ "\u0421\u0442\u0440\u0430\u043D\u0438\u0447\u043A\u0430");
+ // in case of plain ascii
+ // wb.setSheetName(0, "HSSF Test");
+ // create a sheet with 30 rows (0-29)
+ int rownum;
+ for (rownum = (short) 0; rownum < 30; rownum++) {
+ // create a row
+ r = s.createRow(rownum);
+ // on every other row
+ if ((rownum % 2) == 0) {
+ // make the row height bigger (in twips - 1/20 of a point)
+ r.setHeight((short) 0x249);
+ }
+
+ //r.setRowNum(( short ) rownum);
+ // create 10 cells (0-9) (the += 2 becomes apparent later
+ for (short cellnum = (short) 0; cellnum < 10; cellnum += 2) {
+ // create a numeric cell
+ c = r.createCell(cellnum);
+ // do some goofy math to demonstrate decimals
+ c.setCellValue(rownum * 10000 + cellnum
+ + (((double) rownum / 1000)
+ + ((double) cellnum / 10000)));
+
+ String cellValue;
+
+ // create a string cell (see why += 2 in the
+ c = r.createCell((short) (cellnum + 1));
+
+ // on every other row
+ if ((rownum % 2) == 0) {
+ // set this cell to the first cell style we defined
+ c.setCellStyle(cs);
+ // set the cell's string value to "Test"
+ c.setCellValue("Test");
+ } else {
+ c.setCellStyle(cs2);
+ // set the cell's string value to "\u0422\u0435\u0441\u0442"
+ c.setCellValue("\u0422\u0435\u0441\u0442");
+ }
+
+
+ // make this column a bit wider
+ s.setColumnWidth((short) (cellnum + 1), (short) ((50 * 8) / ((double) 1 / 20)));
+ }
+ }
+
+ //draw a thick black border on the row at the bottom using BLANKS
+ // advance 2 rows
+ rownum++;
+ rownum++;
+
+ r = s.createRow(rownum);
+
+ // define the third style to be the default
+ // except with a thick black border at the bottom
+ //cs3.setBorderBottom(cs3.BORDER_THICK);
+
+ //create 50 cells
+ for (short cellnum = (short) 0; cellnum < 50; cellnum++) {
+ //create a blank type cell (no value)
+ c = r.createCell(cellnum);
+ // set it to the thick black border style
+ c.setCellStyle(cs3);
+ }
+
+ //end draw thick black border
+
+
+ // demonstrate adding/naming and deleting a sheet
+ // create a sheet, set its title then delete it
+ s = wb.createSheet();
+ wb.setSheetName(1, "DeletedSheet");
+ wb.removeSheetAt(1);
+
+ wb.write(resp.getOutputStream());
+ }
+}
diff --git a/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/categories.jsp b/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/categories.jsp
index e712fcb..bf96820 100644
--- a/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/categories.jsp
+++ b/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/categories.jsp
@@ -2,14 +2,6 @@
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-
-
-
- Categories
-
-
-
-
<%
List categories = (List) request.getAttribute("categories");
@@ -60,6 +52,3 @@
|
-
-
-
diff --git a/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/editionCategorie.jsp b/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/editionCategorie.jsp
index 7b0f51a..7935e41 100644
--- a/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/editionCategorie.jsp
+++ b/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/editionCategorie.jsp
@@ -1,13 +1,5 @@
<%@ page import="fr.lteconsulting.training.moviedb.model.Categorie" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-
-
-
- Edition catégorie
-
-
-
-
<%
Categorie categorie = (Categorie) request.getAttribute("categorie");
@@ -19,6 +11,4 @@
">
-
-
-
+
\ No newline at end of file
diff --git a/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/editionFabricant.jsp b/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/editionFabricant.jsp
index 77d9d4a..6ec426a 100644
--- a/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/editionFabricant.jsp
+++ b/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/editionFabricant.jsp
@@ -1,13 +1,5 @@
<%@ page import="fr.lteconsulting.training.moviedb.model.Fabricant" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-
-
-
- Edition catégorie
-
-
-
-
<%
Fabricant fabricant = (Fabricant) request.getAttribute("fabricant");
@@ -20,6 +12,4 @@
-
-
-
+
\ No newline at end of file
diff --git a/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/editionProduit.jsp b/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/editionProduit.jsp
index f805119..ba91042 100644
--- a/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/editionProduit.jsp
+++ b/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/editionProduit.jsp
@@ -3,14 +3,6 @@
<%@ page import="fr.lteconsulting.training.moviedb.model.Produit" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-
-
-
- Edition produit
-
-
-
-
<%
Produit produit = (Produit) request.getAttribute("produit");
@@ -43,6 +35,4 @@
}%>
-
-
-
+
\ No newline at end of file
diff --git a/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/fabricants.jsp b/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/fabricants.jsp
index fbe86a5..7707110 100644
--- a/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/fabricants.jsp
+++ b/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/fabricants.jsp
@@ -2,14 +2,6 @@
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-
-
-
- Categories
-
-
-
-
<%
List fabricants = (List) request.getAttribute("fabricants");
@@ -62,7 +54,4 @@
|
-
-
-
-
+
\ No newline at end of file
diff --git a/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/produits.jsp b/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/produits.jsp
index 856bb2b..33890a7 100644
--- a/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/produits.jsp
+++ b/formation-programmation-java/projets/javaee/movie-db/src/main/webapp/WEB-INF/produits.jsp
@@ -1,14 +1,6 @@
<%@ page import="fr.lteconsulting.training.moviedb.model.Produit" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-
-
-
- Produits
-
-
-
-
<%
List produits = (List) request.getAttribute("produits");
@@ -68,5 +60,5 @@
-
-
+Exportation
+export.xls
\ No newline at end of file