Skip to content

Commit 097782b

Browse files
Excel Jsps con Directivas
1 parent 29a24e3 commit 097782b

File tree

4 files changed

+57
-2
lines changed

4 files changed

+57
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,4 @@
198198
/ScriptletsJSP/target/
199199
/DeclaracionesJSP/target/
200200
/DocumentosJSP/target/
201+
/ExcelJSP/target/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package utilerias;
2+
3+
import java.text.SimpleDateFormat;
4+
import java.util.Date;
5+
6+
public class Conversiones {
7+
private static final String FORMATO_FECHA= "dd-MM";
8+
9+
public static String format(Date fecha){
10+
SimpleDateFormat formateador = new SimpleDateFormat(FORMATO_FECHA);
11+
return formateador.format(fecha);
12+
}
13+
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<title>Start Page</title>
4+
<title>Generacion de Reposrte Excel</title>
55
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
66
</head>
77
<body>
8-
<h1>Hello World!</h1>
8+
<h1>Generacion de Reposrte Excel</h1>
9+
<br /><!-- comment -->
10+
<a href="reporteExcel.jsp">Link al reporte de Excel</a>
11+
912
</body>
1013
</html>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<%@page import="utilerias.Conversiones, java.util.Date" %>
2+
<%@page contentType="aplication/vnd.ms-excel" %>
3+
<%
4+
String nombreArchivo = "reporte.xls";
5+
response.setHeader("Content-Disposition", "attachment;filename" + nombreArchivo);
6+
7+
%>
8+
9+
<!DOCTYPE html>
10+
<html>
11+
<head>
12+
<title>Reporte de Excel</title>
13+
</head>
14+
<body>
15+
<h1>Reporte de Excel</h1>
16+
<table border="1">
17+
<tr>
18+
<th>CURSO</th>
19+
<th>DESCRIPCION</th>
20+
<th>FECHA</th>
21+
</tr>
22+
<tr>
23+
<th>1. Fundamento de Java </th>
24+
<th>Aprenderemos la sitaxis basica de Java</th>
25+
<th><%= Conversiones.format(new Date()) %></th>
26+
</tr>
27+
28+
<tr>
29+
<th>2. Fundamento con Java </th>
30+
<th>Pondemos en pranctica conceptos de la programacion POO</th>
31+
<th><%= Conversiones.format(new Date()) %></th>
32+
</tr>
33+
34+
35+
36+
</table>
37+
</body>
38+
</html>

0 commit comments

Comments
 (0)