Thu Aug 11, 2011 8:04 am
// you can get your base and parent from the database
String base = "e1";
String parent = "e2";
String filename = "Inventario de la linea 402.pdf"; //my own filename
// you can write http://localhost
String filepath = "C:/"; //located on Local C harddisk
BufferedInputStream buf = null;
ServletOutputStream myOut = null;
try {
myOut = response.getOutputStream(); //Getting mistake here
File myfile = new File(filepath + filename);
//set response headers
response.setContentType("application/pdf"); //I want to download a PDF file
response.addHeader(
"Content-Disposition", "attachment; filename=" + filename);
response.setContentLength((int) myfile.length());
FileInputStream input = new FileInputStream(myfile);
buf = new BufferedInputStream(input);
int readBytes = 0;
//read from the file; write to the ServletOutputStream
while ((readBytes = buf.read()) != -1) {
myOut.write(readBytes);
}
} catch (IOException ioe) {
} finally {
//close the input/output streams
if (myOut != null) {
myOut.close();
}
if (buf != null) {
buf.close();
}
}
}
myOut = response.getOutputStream(); //Getting mistake here
java.lang.NullPointerException
at enlineatabla.sapitof(enlineatabla.java:367)
the line is:
myOut = response.getOutputStream(); //Getting mistake here
Thu Aug 11, 2011 4:26 pm
Thu Aug 11, 2011 8:41 pm
String linea[] = {"Seleccione...", "401", "402", "403", "405", "406", "407", "408",
"409", "410", "411", "412", "Jaula 1", "Jaula 2", "Jaula 3", "Jaula 4"};
String estacion[] = {"Seleccione...", "FVT inicial", "FVT final", "Troubleshoot",
"FA", "Burning Inicial", "Burning Extendido", "Contencion 3-4", "OBE", "Jaula 1",
"Jaula 2", "Jaula 3", "Jaula 4"};
String estacion1, linea1;
String Linea2, estacion2, elemento, tecnico, capitaldtv, estado, fecha;
Connection conexion; //mysql
Statement statement; //mysql
ResultSet rs; //mysql
List<auxenlineatabla> lista = new ArrayList<auxenlineatabla>();
Document documento; //Creado para itext pdf
PdfPTable tabla; //Creado para itext pdf
float[] medidaceldas = {2.90f, 2.90f, 3.10f, 2.90f, 3.50f, 2.90f, 2.90f}; //Creado para itext pdf
Paragraph pg; //Creado para itext pdf
PdfPCell celda; //Creado para itext pdf
BaseColor color = new BaseColor(192, 192, 192); //Creado para itext pdf
String archivo;
Resource pdfResource; //Creado para Descargar el pdf
private static final int BYTES_DOWNLOAD = 1024;
private Resource pdfResourceDynFileName;
[color=#BF0040][b]HttpServletResponse response;[/b][/color]
private String filename;
myOut = response.getOutputStream(); //Getting mistake here
response.setContentType("application/pdf"); //I want to download a PDF file
response.addHeader("Content-Disposition", "attachment; filename=" + filename);
response.setContentLength((int) myfile.length());
Thu Aug 11, 2011 8:54 pm
HttpServletResponse response;
HttpServletResponse response=null;
Fri Aug 12, 2011 3:01 am
Fri Aug 12, 2011 3:16 am
Fri Aug 12, 2011 4:56 pm
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.