【发布时间】:2013-02-02 13:14:43
【问题描述】:
我正在使用 commons fileupload 上传图像文件,使用 post 方法。图片上传成功,但是当我尝试使用request.getParameter("field_name"); 方法访问表单的任何其他字段时,我得到所有相应字段的空值,因此我得到了各种异常。
这是我的表单代码:
<form id="add-book" name="add-book" class="add-book" method="post" action="ServletImageUpload" enctype="multipart/form-data">
<table>
<tr>
<td>field1</td>
<td><input type="text" name="isbn" id="isbn" /></td>
</tr>
<tr>
<td>Upload image</td>
<td><input type="file" name="upload" /></td>//image upload field
</tr>
<!--rest of the form fields -->
</form>
那么request.getParameter(); 方法有问题吗?为什么我无法获取参数的值?
【问题讨论】:
标签: java forms servlets multipart