Ver Mensaje Individual
  #4 (permalink)  
Antiguo 27/01/2015, 12:10
Avatar de lucy87
lucy87
 
Fecha de Ingreso: mayo-2011
Mensajes: 25
Antigüedad: 13 años
Puntos: 0
Respuesta: Excel en servidor con jsp y servlets

Muchas gracias por tu ayuda! resulto que si mandaba llamar mi servlet con javascript era lo que me hacia, así que lo mando llamar con un FORM y todo perfecto, me descarga el excel después de generarlo. Tenia el problema para pasarle los parámetros pero con el form se soluciona.

Por si a alguien le ayuda:
JSP

Código PHP:
<form action="/MiServlet" method="POST">
...
....
<
input type="submit" id="Generar" value="Generar"/> 
Servlet
Código PHP:
response.setContentType("application/vnd.ms-excel");
response.addHeader("content-disposition",
                
"attachment; filename=Test.xls");
Workbook libro = new HSSFWorkbook();
Sheet hoja libro.createSheet("Movimientos RH");
Row fila1 hoja.createRow(0);
Cell Ctitulo fila1.createCell(0);
Ctitulo.setCellValue("MOVIMIENTOS " folioInicial " AL " folioFinal);
....
...
...
libro.write(response.getOutputStream());