tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 박성수 <ssp...@thinkfree.com>
Subject [bug report] servlet's twice calling
Date Wed, 25 Apr 2001 05:25:54 GMT
os : unix & windows 2000
servlet container : tomcat 3.2.1 release

For the two implementations presented below, requests submitted from the file fileupload.html
call up fileUpload2.jsp twice.

The file fileUpload2.jsp is called only once when fileupload.html submits a request on other
serlet engines(servlet containers).

Apparently this is a tomcat bug. The results are identical for UNIX and Windows 2000 systems.

☞ fileupload.html

<form action="/examples/fileUpload2.jsp"
 method=post enctype=multipart/form-data>
<input type=file size=50 name="upload">
<input type=reset value="cancel"><br>
<input type=submit value="file transmit">


☞ fileUpload2.jsp

<%@ page contentType="text/html; charset=euc-kr" 
  errorPage="error.jsp"
  import="java.io.*"
  language="java" 
%>

<%

 boolean checkFileSize = true;

 int fileSize = request.getContentLength();
 System.out.println("contentLength : " + fileSize);
 out.println("contentLength : " + fileSize + "<br>");

 // limited file size (5MB)
 if ( fileSize > 1024*1024*5 ) {
    System.out.println("Large file size");
  checkFileSize = false;
  out.println("<script language=JavaScript>");
        out.println("alert(\"too large file. retry again...\");");
        out.println("history.back();");
        out.println("</script>");
        out.flush();
    }
 
 if ( checkFileSize ) {
  System.out.println("Small file size");
  out.println("run file upload");
 }
 System.out.println("end....");
 
%>



Mime
View raw message