解决方案:
1、首先在pom.xml中添加
然后在applicationContext.xml中添埋孙加即可解决,这样的话spring会对表单的数据进行处理,就算使用了enctype="multipart/form-data"进行传值也缓培能拿到数据
1、确拍早认;\x0d\x0a2、确认commons-fileupload.jar 和 org.springframework.web.jar 存在环境\x0d\x0a3、MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;\x0d\x0a这一句会报颂贺腔错:ApplicationHttpRequest cannot be cast to MultipartHttpServletRequest\x0d\x0a 野衫 解决办法是通过这种方式:\x0d\x0aMultipartResolver resolver = new CommonsMultipartResolver(request.getSession().getServletContext())\x0d\x0aMultipartHttpServletRequest multipartRequest = resolver.resolveMultipart(request)欢迎分享,转载请注明来源:内存溢出
评论列表(0条)