org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null
代码本身是没有问题的,但是C++的项目sso访问我写的java项目的时候按照原有的方式找不到对应的servlet,所以还需要sso访问servlet,就在sso访问servlet的时候出错了,请大牛指点下
页面代码
- HTML code
<f:loadBundle basename="com.webapp.resource.WebAppResource"var="resource" /> <h:form id="fromUpload" enctype="multipart/form-data" onsubmit="startProgress()"> 里边是内容…… </h:form>
项目本身访问Servlet的js代码
- JScript code
function submitUpload(){ usersFunction.getUsernameAndPassword(function(data){ if(data.length > 3){ var fromUpload = document.getElementById("fromUpload"); fromUpload.action='http://192.168.0.153:8080/users/servlet/SSOAuth?PWSecurity=true&username=' +data.split(",")[0]+'&password='+data.split(",")[1]+'&goto=../servlet/addErrorMsg? returnUrl='+'addError.faces'; fromUpload.method="POST"; fromUpload.submit(); }});}
SSO访问Servlet的js代码
- JScript code
function submitUpload(){ usersFunction.getUsernameAndPassword(function(data){ if(data.length > 3){ var fromUpload = document.getElementById("fromUpload"); fromUpload.action='http://192.168.0.153:8080/users/servlet/SSOAuth?PWSecurity=true&username=' +data.split(",")[0]+'&password='+data.split(",")[1]+'&goto=../servlet/addErrorMsg? returnUrl='+'addError.faces'; fromUpload.method="POST"; fromUpload.submit(); }});}
------解决方案--------------------
onsubmit="startProgress()"
换成
action="startProgress()"
试试。
------解决方案--------------------
解决了就好啊