求助,servlet怎么不能获得从jsp传来的数据啊!!
在jsp中的代码:
<form action= "../uploadImg " method= "post " enctype= "multipart/form-data " name= "form1 ">
<table>
<tr>
<td align= "left "> Name: </td>
<td align= "left "> <input type= "text " name= "picName "> </td>
</tr>
<tr>
<td align= "left "> Path: </td>
<td align= "left "> <input type= "file " name= "picPath "> </td>
</tr>
<tr>
<td align= "left "> Describe: </td>
<td align= "left "> <textarea rows= "5 " cols= "30 " name= "picDescribe " > </textarea> </td>
</tr>
<tr>
<td align= "center "> </td>
<td align= "center ">
<input type= "submit " name= "bSubmit " id= "bSubmit ">
<input type= "reset " name= "bReset " id= "bReset ">
</td>
</tr>
</table>
</form>
在servlet中的代码:
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws
ServletException,
IOException {
// TODO Auto-generated method stub
String picName = req.getParameter( "picName ");
System.out.println(picName);
String picPath = req.getParameter( "picPath ");
System.out.println(picPath);
String picDescribe = req.getParameter( "picDescribe ");
}
结果打印出来的值都是null
为什么啊~~~,改了好长时间都没成功!!
------解决方案--------------------lz的混合表单上传在Servlet中这样取值当然为空了。
------解决方案--------------------web.xml配置好了没
------解决方案--------------------把enctype= "multipart/form-data "删除!
如果要上传文件不能从request中获得值,
如果用SmartUpload组件上传,则取值方法为“SmartUpload.getRequest().getParameter( "aa ");”