毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> java技术 >> 正文

upload.parseRequest(request)返回为空

更新时间:2014-5-14:  来源:毕业论文

<html> <head> <title>excel导入到数据库</title> </head> <body>     <h3>excel导入到数据库:</h3>     选择一个文件进行上传:     <br />     <form action="UploadFile_view.jsp?action=submit" method="post"         enctype="multipart/form-data">         <input type="file" name="file" size="50" /> <br /> <input             type="submit" value="上传" />     </form>     <%         if (request.getParameter("action") != null) {             if (request.getParameter("action").equals("submit")) {                 int maxFileSize = 5000 * 1024;                 int maxMemSize = 5000 * 1024;                 ServletContext context = pageContext.getServletContext();                 String filePath = context.getInitParameter("file-upload");                 String contentType = request.getContentType();                 if ((contentType.indexOf("multipart/form-data") >= 0)) {                     DiskFileItemFactory factory = new DiskFileItemFactory();                     factory.setSizeThreshold(maxMemSize);                     factory.setRepository(new File("c:\\temp"));                     ServletFileUpload upload = new ServletFileUpload(                             factory);                     upload.setSizeMax(maxFileSize);                     List fileItems = upload.parseRequest(request);                 }             }         }     %> </body> </html>

就是到这里fileItems就为空了
<html> <head> <title>excel导入到数据库</title> </head> <body>     <h3>excel导入到数据库:</h3>     选择一个文件进行上传:     <br />     <form action="UploadFile_view.jsp?action=submit" method="post"         enctype="multipart/form-data">         <input type="file" name="file" size="50" /> <br /> <input             type="submit" value="上传" />     </form>     <%         if (request.getParameter("action") != null) {             if (request.getParameter("action").equals("submit")) {                 int maxFileSize = 5000 * 1024;                 int maxMemSize = 5000 * 1024;                 ServletContext context = pageContext.getServletContext();                 String filePath = context.getInitParameter("file-upload");                 String contentType = request.getContentType();                 if ((contentType.indexOf("multipart/form-data") >= 0)) {                     DiskFileItemFactory factory = new DiskFileItemFactory();                     factory.setSizeThreshold(maxMemSize);                     factory.setRepository(new File("c:\\temp"));                     ServletFileUpload upload = new ServletFileUpload(                             factory);                     upload.setSizeMax(maxFileSize);                     List fileItems = upload.parseRequest(request);                 }             }         }     %> </body> </html>

就是到这里fileItems就为空了

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。