Method in Controller
Public String excelinsertteachers (multipartfile file,httpservletrequest request, HttpSession session, HttpServletResponse response) throws illegalstateexception, IOException {}
This method may go many times, but there is no upload file operation, then this method will have an exception, how to solve it?
PublicString excelinsertteachers (httpservletrequest request, HttpSession session, HttpServletResponse Response) throwsIllegalStateException, IOException {multipartfile file=NULL; BooleanIsmultipart =servletfileupload.ismultipartcontent (Request); if(ismultipart) {multiparthttpservletrequest multipartrequest=webutils.getnativerequest (Request, multiparthttpservletrequest.class); File= Multipartrequest.getfile ("Multipartfile"); }
Get to the method to determine whether there is currently a file commit, and if so, to do the read file operation.
I asked a predecessor, and he meant it. You can specify that the current existence does not exist by setting parameters .... But I can't find it. Scratching his heads. jpg
If a friend knows other ways, you can tell me other ways, thank you for scratching your heads. gif.
Multipartfile file If there are no files to upload how to solve