On Sat, 18 Aug 2001, Hiten Hemchand Vira wrote:

> Is there no one who can give solution to the following problem ????
> 

JSP pages consume the input stream on a POST transaction as they look for
request parameters.  Therefore, by the time your scriptlet is executed,
there is nothing left to read.  You should really be doing this with a
servlet instead, where you have complete control over the timing of
things.

Craig



> -----Original Message-----
> From: Hiten Hemchand Vira 
> Sent: Friday, August 17, 2001 4:10 PM
> To: [EMAIL PROTECTED]
> Subject: Posting data to a JSP kept residing in Tomcat
> 
> 
> Hi,
>     I am posting some data using HTTP to a JSP kept in the
> "examples/jsp" directory of Tomcat. The code of the JSP is as follows
> 
> "<%@ page language="java" import="java.io.*" %>
> <%
> 
> int len;
> final int blockSize=1024;
> byte buf[]=new byte[blockSize];
> 
> ServletInputStream sis=request.getInputStream();
> FileOutputStream fos=new FileOutputStream("C:\\test.txt");
> 
> while ((len=sis.read(buf, 0, blockSize))!=-1) 
> { 
> fos.write(buf, 0, len);
> }
> 
> sis.close();
> fos.close();
> 
> %>"
> 
> But when some data is posted to the above JSP page instead of data being
> written to the file C:\test.txt only the file C:\test.txt gets created
> with zero bytes as the size.
> 
> There is no problem with the JSP because the JSP runs fine when tested
> under Java Web Server 2.0. The file C:\test.txt is created with proper
> data.
> 
> One more thing to note is that the data which is posted is captured in
> the log file jasper.log.
> 
> Any pointers regarding what could be the problem?? Please reply to my id
> also
> 
> TIA,
> [EMAIL PROTECTED]
> 

Reply via email to