日期:2014-05-18  浏览次数:20727 次

jsp,getParameter为什么取不到数据?
1.htm,上面 function   uploadFile(){  
if   (document.all.uploadfile.value== " "){  
alert( "你必须选择一个文件才能进行上传! ");  
return   false;  
}  
if   (document.all.username.value== " "){  
alert( "你必须先指定该用户的登录名! ");  
return   false;  
}  
document.all.picName.value   =   document.all.username.value;
document.all.uploadform.submit();  
}  
form:
<form   name= "uploadform "   method= "post "   action= "smartupload.jsp "   ENCTYPE= "multipart/form-data ">
                                        <TR>
                                            <TD   width= "80 "   height= "25 "   align= "left "   nowrap> 照片
                                                <input   type= "button "   name= "uploadPic "   value= "上传 "   onClick= "uploadFile() ">
<INPUT   name= "picName "   id= "picName "   value   = " "   type= "hidden ">
                                            </TD>
                                            <TD   height= "25 "> <input   type= "file "   name= "uploadfile "   size= "20 "> </TD>
                                        </TR> </form>

smartupload.jsp:
String   picName   =   request.getParameter( "picName ");
为什么取不到参数picName的值?在1.htm上picName确定是已经有值了

------解决方案--------------------
关注
------解决方案--------------------
因为你用了这个ENCTYPE= "multipart/form-data "
SmartUpload uploader = new SmartUpload();
uploader.upload();
String sysTplPath = uploader.getRequest().getParameter( "picName ");

参考一下,不过我没测试啊
------解决方案--------------------
<INPUT name= "picName " id= "picName " value = " " type= "hidden ">
你value里都没有值,怎么取?