问题描述
- 关于enctype问题, multipart/form-data
-
the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null,添加完信息之后到列表页,等一会就报这个错,求大神解答!enctype="multipart/form-data"这句已经在form里加上了
解决方案
现在的问题是,我debug之后,第一次都得到值了,而且也增加成功了,但是他还会再加载增加一次,这时候就全没有值了,重点是为什么要再加戴增加一次呢
org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null
at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.(FileUploadBase.java:908)
at org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331)
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:351)
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
at com.icss.base.util.UploadFile.getParameter(UploadFile.java:227)
at com.icss.biz.calculateTaskManagement.controller.CalculateTaskManagementController.getMapOfRequest(CalculateTaskManagementController.java:304)
at com.icss.biz.calculateTaskManagement.controller.CalculateTaskManagementController.save(CalculateTaskManagementController.java:239)
at com.icss.biz.calculateTaskManagement.controller.CalculateTaskManagementController.performTask(CalculateTaskManagementController.java:88)
at com.icss.base.web.BaseController.doPerformTask(BaseController.java:103)
at com.icss.base.web.BaseController.doGet(BaseController.java:73)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.icss.base.web.EncodingFilter.doFilter(EncodingFilter.java:145)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.icss.base.web.SingleSignOnClient.doFilter(SingleSignOnClient.java:376)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.icss.tds.common.filter.ContextPathRequestFilter.doFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.icss.tds.common.filter.EncodingFilter.doFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:620)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
然后就报地堆这个异常
解决方案二:
ENCTYPE="multipart/form-data",这句话的意思是把你表单的所有信息以流方式提交,页面上的所有信息已经都转换为了文件流,为的是能让服务端得到你上传的文件的文件流。当然,你填写的一些文本信息也变成了流,用request.getParameter()方法当然得不到值了??
? 用request.getInputStream()来接收流数据吧......
答案就在这里:ENCTYPE=multipart-form-data
解决方案三:
也可能是你服务器的错误。你用的语言/框架是什么。
解决方案四:
java语言/没用框架,直接sevlet,tomcat
解决方案五:
你的到底是添加页面报测错误还是列表?意思是你的添加那个页面提交了2次数据到保存页面,一次又数据一次没有?自己检查下js是不是做了什么操作了,怎么会提交了了2次
解决方案六:
我觉得你可能是页面提交有问题吧,不然怎么会自己提交两次呢