因为要上传文件,所以有file控件,这样就必须有ENCTYPE="multipart/form-data"(二进制方式上传),这样一来,form表单中其他控件的值用request.getParameter取出来就为null值,所以用apache file-upload, smart upload等等这样组件的话,需要把request做为参数传给组件,根据[color=red]if (!fileitem.isFormField())[/color]来判断是否是普通的文本域,此处为非文本域,然后用组件的方法去取值即可
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
</head>
<body bgcolor="#FFFFFF">
<form method="post" action="File.jsp" enctype="multipart/form-data">
<p> file1:
<input type="file" name="File1">
</p>
<p> title1:
<input type="text" name="File1">
</p>
<p>name:
<input type="text" name="myname">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset">
</p>
</form>
</body>
</html>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
</head>
<body bgcolor="#FFFFFF">
<form method="post" action="File.jsp" enctype="multipart/form-data">
<p> file1:
<input type="file" name="File1">
</p>
<p> title1:
<input type="text" name="File1">
</p>
<p>name:
<input type="text" name="myname">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset">
</p>
</form>
</body>
</html>