You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hiten Hemchand Vira <Hi...@infy.com> on 2001/08/17 12:40:15 UTC

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,
Hiten@infy.com