Hi folks,
Let me describe my problem,
I am generating a PDF doc in the Action and all works fine, it could be show in IE, in Netscape and in Firefox, when I try to showing it in a new window (user requirement) using JS it works in NS and Firefox, but IE shows a popup window asking if I want to download it or open it if i choose anything, then the next error appears: It could not be downloaded, IE could not open this site, try again...
I don know what is happenning, please help...
By the way all this messages are in IE not in the Tomcat...
Code in the Action: execute(...) { ..... // Sending parameters via POST conn.setDoOutput( true );
OutputStreamWriter writerServletPDF = new OutputStreamWriter( conn.getOutputStream() );
writerServletPDF.write( parameters.toString() ); writerServletPDF.flush(); writerServletPDF.close();
//Obtener la respuesta
BufferedInputStream reader = new BufferedInputStream( conn.getInputStream() );
String contentType = conn.getContentType();
if ( "application/pdf".equals( contentType ) ) { response.setContentType( contentType ); response.setHeader( "Content-disposition", "inline; filename=" + "factura.pdf" );
BufferedOutputStream writer = new BufferedOutputStream( response.getOutputStream() );
String line = null;
byte[] buffer = new byte[2048];
int bytesRead;
while ( -1 != ( bytesRead = reader.read( buffer, 0, buffer.length ) ) ) {
writer.write( buffer, 0, bytesRead );
} reader.close(); writer.flush(); writer.close();
return null;
} else {
return mapping.findForward( "errorPDF" );
}
}
JS code:
function mostrarPDF(numCuentaFactura, mesFactura, anoFactura)
{
var w = screen.availWidth/2;
var h = screen.availHeight/2;
var opciones="toolbar=no,location=no,directories=no,resizable=yes,status=yes,menubar=no,titlebar=yes,top=0,left=0,scrollbars=yes,width="+w+",height="+h;
var url = "/iusacellClientesCorporativos/mostrarFactura.do?anoFactura="+anoFactura+"&numCuentaFactura="+numCuentaFactura+"&mesFactura="+mesFactura;
window.open(url,'', opciones);
}
JSP code:
<a href="javascript:mostrarPDF('<c:out value="${subcuenta.numCuenta}"/>','<c:out value="${mesFactura.key}" />','2004')">
<c:out value="${mesFactura.value}" />
</a>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]