Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Asistencia
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Billy Larru
Asistencia
Commits
49a3d959
Commit
49a3d959
authored
6 years ago
by
Billy Larru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
estructurando servlet de policias
parent
8ab85aae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
PoliciasServlet.java
src/main/java/asistencia/servlets/PoliciasServlet.java
+15
-4
No files found.
src/main/java/asistencia/servlets/PoliciasServlet.java
View file @
49a3d959
...
...
@@ -18,6 +18,19 @@ public class PoliciasServlet extends HttpServlet {
@Override
protected
void
service
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
String
accion
=
request
.
getParameter
(
"accion"
);
switch
(
accion
)
{
case
"exportarMontos"
:
exportarMontos
(
request
,
response
);
break
;
default
:
response
.
getWriter
().
print
(
"Especifique un parametro"
);
}
}
public
void
exportarMontos
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename=sample.xls"
);
OutputStream
output
=
response
.
getOutputStream
();
...
...
@@ -25,13 +38,11 @@ public class PoliciasServlet extends HttpServlet {
String
[]
headers
=
{
"id"
,
"nombres"
,
"apellidos"
,
"edad"
};
Object
[][]
data
=
new
Object
[][]{
new
Object
[]{
"1"
,
"Felipe"
,
"Escala"
,
"22"
},
new
Object
[]{
"2"
,
"Luis"
,
"Gangas"
,
"23"
},
};
new
Object
[]{
"2"
,
"Luis"
,
"Gangas"
,
"23"
},};
excel
.
setHeaders
(
headers
);
excel
.
setSheetName
(
"Pruebas"
);
excel
.
setData
(
data
);
excel
.
generate
();
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment