1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
try { DiskFileItemFactory factory = getDiskFileItemFactory(file);
ServletFileUpload upload = getServletFileUpload(factory);
String msg = uploadParseRequest(upload, request, uploadPath);
System.out.println(msg); if(msg == "文件上传成功!") { request.setAttribute("msg",msg); request.getRequestDispatcher("info.jsp").forward(request, response); }else { msg ="请上传文件"; request.setAttribute("msg",msg); request.getRequestDispatcher("info.jsp").forward(request, response); }
} catch (FileUploadException e) { e.printStackTrace(); }
|