Julia, I think you have a problem with the html invoking .. please descripe your problem in more details so we don't waist time. Regards Omar
>From: Julia Zheng <[EMAIL PROTECTED]> >Reply-To: "A mailing list for discussion about Sun Microsystem's Java > Servlet API Technology." <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Re: about servletoutputstream >Date: Mon, 31 Dec 2001 22:22:48 -0800 >MIME-Version: 1.0 >Received: from [192.18.99.108] by hotmail.com (3.2) with ESMTP id >MHotMailBDFAA0BF00944004320FC012636CC7D50; Mon, 31 Dec 2001 22:23:18 -0800 >Received: from swjscmail1 (swjscmail1.Sun.COM [192.18.99.107])by >swjscmail2.java.sun.com (Postfix) with ESMTPid 529792109B; Mon, 31 Dec 2001 >23:21:44 -0700 (MST) >Received: from JAVA.SUN.COM by JAVA.SUN.COM (LISTSERV-TCP/IP release 1.8d) >with spool id 890371 for [EMAIL PROTECTED]; Mon, 31 >Dec 2001 23:20:54 -0700 >Received: from web20405.mail.yahoo.com (web20405.mail.yahoo.com >[216.136.226.124]) by swjscmail1.java.sun.com (Postfix) with SMTP id > B9AE14801 for <[EMAIL PROTECTED]>; Mon, 31 Dec 2001 >23:20:53 -0700 (MST) >Received: from [154.5.136.202] by web20405.mail.yahoo.com via HTTP; Mon, 31 >Dec 2001 22:22:48 PST >From [EMAIL PROTECTED] Mon, 31 Dec 2001 22:23:22 -0800 >Delivered-To: [EMAIL PROTECTED] >Message-ID: <[EMAIL PROTECTED]> >Sender: "A mailing list for discussion about Sun Microsystem's Java > Servlet API Technology." <[EMAIL PROTECTED]> >In-Reply-To: <[EMAIL PROTECTED]> > >Richard: > >I invoke my servlet via a html file. Since it doesn't >work properly, I didn't use any request parameters at >this time. When I invoke doPost(req, res) by using ><method = "POST" >, nothing get display, the screen is >empty. also nothing in the log file. > >thank you so much for help. I really have no idea. > > >julia > >--- Richard Yee <[EMAIL PROTECTED]> wrote: > > Julia, > > How are you invoking the servlet via the post > > method? It doesn't seem to > > use any request parameters. What happens when you > > try and invoke it via > > the post method? Have you check your server logs? > > > > Regards, > > > > Richard > > > > > > At 01:31 PM 12/31/2001 -0800, you wrote: > > >thank you for your reply! > > > > > >yes, I do implement doPost() method. > > > > > >my coding: > > > > > > public void doPost(HttpServletRequest request, > > >HttpServletResponse response) > > > throws ServletException, IOException > > > { > > > ServletOutputStream out = > > >response.getOutputStream (); > > > // Set the output data's mime type > > > response.setContentType(CONTENT_TYPE); > > > // create an input stream from fileURL > > > String fileURL = > > "http://com.company.abc.xml"; > > > //Content-disposition header - open in browser > > > response.setHeader("Content-disposition", > > >"inline" ); > > > > > > BufferedInputStream bis = null; > > > BufferedOutputStream bos = null; > > > URL url = new URL ( fileURL ); > > > > > > try > > > { > > > URLConnection conn = url.openConnection(); > > > // Use Buffered Stream for > > reading/writing. > > > bis = new > > >BufferedInputStream(conn.getInputStream()); > > > bos = new BufferedOutputStream(out); > > > 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); > > > } > > > out.flush(); > > > bos.flush(); > > > } > > > catch(final MalformedURLException e) > > > { > > > cat.error ( "MalformedURLException." ); > > > throw e; > > > } > > > catch(final IOException e) { > > > cat.error ( "IOException." ); > > > throw e; > > > } > > > finally > > > { > > > if (bis != null) > > > bis.close(); > > > if (bos != null) > > > bos.close(); > > > } > > > > > >public void doGet(HttpServletRequest request, > > >HttpServletResponse response) > > > throws ServletException, IOException > > > { > > > doPost(request, response); > > >} > > > > > >julia > > > > >___________________________________________________________________________ > > To unsubscribe, send email to [EMAIL PROTECTED] > > and include in the body > > of the message "signoff SERVLET-INTEREST". > > > > Archives: > > >http://archives.java.sun.com/archives/servlet-interest.html > > Resources: > > >http://java.sun.com/products/servlet/external-resources.html > > LISTSERV Help: > > http://www.lsoft.com/manuals/user/user.html > > > > >__________________________________________________ >Do You Yahoo!? >Send your FREE holiday greetings online! >http://greetings.yahoo.com > >___________________________________________________________________________ >To unsubscribe, send email to [EMAIL PROTECTED] and include in the body >of the message "signoff SERVLET-INTEREST". > >Archives: http://archives.java.sun.com/archives/servlet-interest.html >Resources: http://java.sun.com/products/servlet/external-resources.html >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html > _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
