当前位置: 代码迷 >> Java Web开发 >> JSPSmartUpload 用getrequest方法获得的值还是NULL,求解,先谢了,该怎么解决
  详细解决方案

JSPSmartUpload 用getrequest方法获得的值还是NULL,求解,先谢了,该怎么解决

热度:709   发布时间:2016-04-17 14:49:04.0
JSPSmartUpload 用getrequest方法获得的值还是NULL,求解,先谢了
因为要涉及到文件上传,所以只能加上enctype= "multipart/form-data "  

但是JSPSmartUpload   用getrequest方法获得的值还是NULL,不知道为什么  

代码简化如下:  
<%@   page   language= "java "   import= "java.util.* "   %>  
<%@   page   contentType= "text/html;   charset=gb2312 "   %>  
<jsp:useBean   id= "mySmartUpload "   scope= "page "   class= "com.jspsmart.upload.SmartUpload "   />  
<%  

String   courseid= " ";  
if   (mySmartUpload.getRequest().getParameter( "courseid ")!=null){  
courseid=mySmartUpload.getRequest().getParameter( "courseid ");  
}  
%>  
<form   name= "form1 "   method= "post "   action= " "   enctype= "multipart/form-data ">  
<input   name= "courseid "   type= "text "   id= "courseid "   value= " <%=courseid%> ">  
<input   type= "submit "   name= "Submit "   value= "提交 ">  
</form>


------解决方案--------------------
你看看是不是你的su.initialize(pageContext);没写,没有初始化
------解决方案--------------------
mySmartUpload.initialize(pageContext);
------解决方案--------------------
getrequest是没法用的。
  相关解决方案