You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by 박성수 <ss...@thinkfree.com> on 2001/04/25 14:25:55 UTC
[BUG Report Tomat 3.2.1 release] servlet's twice calling
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....");
%>