Re: attachment in jsp

2002-12-24 Thread Steven J. Owens
On Tue, Dec 24, 2002 at 03:57:49PM -0700, Venkat Muthusamy wrote:
> I am trying to attach a pdf document in JSP.

 What do you mean you're trying to "attach" it?  Do you want the
PDF to come up in the user's browser window for viewing?  If so, just
put the PDF in a static file and redirect the user to it.  If you want
to force the user's browser to pop up the "Save As..." dialog, keep
reading:

> Whenever I access the jsp I am getting error in first time. After
> that it is working fine . Any idea.  While open the url when
> firsttime it is saying (you are downloading *.jsp) in file save
> popup and gives error.After that it shows (you are downloading
> *.pdf)Then it opens the pdf.  Is there a way to suppress this error
> or am i doing something wrong in the code?

 The code below looks basically right, comparing it to my notes
from when I wrote a servlet a few years ago to force a download.

 I don't recall any issue with the browser trying to download the
jsp.  There is an issue that the browser will assume the data file
being sent back is named the same as the page the browser requested.
The browser asks for "foo.jsp" and the server sends it a bunch of
binary data, it's going to naturally assume that data belongs in a
file named "foo.jsp".  You need to look at setting a
Content-Disposition header to set the filename, i.e.:

response.setHeader ("Content-Disposition", "attachment;  
filename=\"yourfilename.pdf\"");

 If that doesn't help, you might want to take a look at the
generated servlet code for this (i.e. use the -keepgenerated option
for your JSP compiler) and see if anything's tripping up the process
by sending extraneous data or headers back before your code gets to
setting headers and sending the binary data.

Steven J. Owens
[EMAIL PROTECTED]

"I'm going to make broad, sweeping generalizations and strong,
 declarative statements, because otherwise I'll be here all night and
 this document will be four times longer and much less fun to read.
 Take it all with a grain of salt." - Me at http://darksleep.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



attachment in jsp

2002-12-24 Thread Venkat Muthusamy
Hi all,
I am trying to attach a pdf document in JSP.

Whenever I access the jsp I am getting error in first time. After that it is working 
fine . Any idea.

While open the url when firsttime it is saying (you are downloading *.jsp) in file 
save popup and gives error.After that it shows (you are downloading *.pdf)Then it 
opens the pdf.
Is there a way to suppress this error or am i doing something wrong in the code?
Any idea to attach a pdf using jsp is also welcome.
thanks
Venkat M

The code is as follows.

<%@ page import="java.io.*" %>
<%

BufferedInputStream bis = null;
   BufferedOutputStream bos = null;


 try {
   response.setContentType("application/pdf");
   response.setHeader("Content-disposition", "attachment; filename=" + 
"JspSyntax.pdf");

  String fileURL = "C:///jspsyntax.pdf";

   OutputStream outp = response.getOutputStream();
   FileInputStream is = new FileInputStream(fileURL);
   // Use Buffered Stream for reading/writing.
bis = new BufferedInputStream(is);
   bos = new BufferedOutputStream(outp);

   byte[] buff = new byte[2048];
   int bytesRead;

   // Simple read/write loop.
   while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
   }
  } catch (java.net.MalformedURLException e) {
   System.out.println("MalformedURLException.");
   e.printStackTrace();
  } catch (final IOException e) {
   e.printStackTrace();
   System.out.println("IOException.");
   //throw e;
  } finally {

   if (bis != null)
bis.close();
   if (bos != null)
bos.close();
  }

%>

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: sql server driver for win nt?

2002-12-24 Thread Martin Gainty

On a related note I am seeking a native JDBC Access driver (our JDBC2ODBC Bridge is slow)Any thoughts on where I might be able to obtain this driver would be appreciatedMany thanks,







Martin Gainty



__

Disclaimer and confidentiality note

Everything in this e-mail and any attachments relating to the official business of Laconia Data Systems (LDS) is proprietary to the company. It is confidential, legally privileged and protected by law. LDS does not own and endorse any other content. Views and opinions are those of the sender unless clearly stated as being that of LDS. 

The person addressed in the e-mail is the sole authorised recipient. Please notify the sender immediately if it has unintentionally reached you and do not read, disclose or use the content in any way.



LDS can not assure that the integrity of this communication has been maintained nor that it is free of errors, virus, interception or interference.

 _GMT-5___

 












>From: Harsha Sanjeewa <[EMAIL PROTECTED]>
>Reply-To: Harsha Sanjeewa <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: sql server driver for win nt?
>Date: Tue, 24 Dec 2002 11:53:18 +0600
>MIME-Version: 1.0
>Received: from mc7-f32.law1.hotmail.com ([65.54.253.39]) by mc7-s2.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Mon, 23 Dec 2002 21:52:35 -0800
>Received: from swjscmail2.java.sun.com ([192.18.99.108]) by mc7-f32.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Mon, 23 Dec 2002 21:52:35 -0800
>Received: from swjscmail1 (swjscmail1.Sun.COM [192.18.99.107])by swjscmail2.java.sun.com (Postfix) with ESMTPid 950492185B; Mon, 23 Dec 2002 22:49:07 -0700 (MST)
>Received: from JAVA.SUN.COM by JAVA.SUN.COM (LISTSERV-TCP/IP release 1.8d) with spool id 4889248 for [EMAIL PROTECTED]; Mon, 23 Dec 2002 22:46:51 -0700
>Received: from mail.srilogic.com (unknown [203.94.76.65]) by swjscmail1.java.sun.com (Postfix) with SMTP id 0AFB84878 for <[EMAIL PROTECTED]>; Mon, 23 Dec 2002 22:46:48 -0700 (MST)
>Received: from HARSHA (unverified [192.168.0.44]) by mail.srilogic.com (SMTPRCV 0.45) with SMTP id <[EMAIL PROTECTED]>; Tue, 24 Dec 2002 11:44:46 0600
>Delivered-To: [EMAIL PROTECTED]
>References: <[EMAIL PROTECTED]>
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Mailer: Microsoft Outlook Express 6.00.2800.1106
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
>Message-ID: <006f01c2ab10$c24678e0$2c00a8c0@HARSHA>
>Sender: A mailing list about Java Server Pages specification and reference <[EMAIL PROTECTED]>
>Organization: Sri Logic
>Return-Path: [EMAIL PROTECTED]
>X-OriginalArrivalTime: 24 Dec 2002 05:52:35.0553 (UTC) FILETIME=[A88E7510:01C2AB10]
>
>FreeTDS might be ok for your requirements.
>Just check on http://www.freetds.org/
>
>-harsha
> - Original Message -
> From: Srdjan Pantic
> To: [EMAIL PROTECTED]
> Sent: Tuesday, December 24, 2002 10:26 AM
> Subject: Re: sql server driver for win nt?
>
>
> > i have been looking for sql server jdbc driver for windows
> > nt. i have gone
> > to microsofts site, but the driver's which are available do
> > not work on win
> > nt platform. Could somebody give a link or clue as to where i
> > can get the
> > driver.
>
> That JDBC driver is working only woth MS SQL Server 2000. You
> probably looking for JDBC driver for earlier MS SQL Server versions.
>
> There is not free JDBC driver, at least not to my knowlwdge. There
> is a couple of commercial drivers available.
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.431 / Virus Database: 242 - Release Date: 12/17/2002
>
> ===
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
>
>==To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
STOP MORE SPAM with the new MSN 8 and get  3 months FREE*. 

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlet