【发布时间】:2014-02-12 05:02:48
【问题描述】:
我正在尝试使用 jQuery 表单插件 (http://malsup.com/jquery/form/) 提交表单
我的 js 看起来像这样:
var options = {
success: callback,
type: "POST",
dataType: 'multipart/form-data',
url: url
};
$('#myForm').ajaxForm(options);
$('#myForm').submit();
我的控制器方法如下所示:
public ModelAndView processForm(MultipartHttpServletRequest request) throws Exception
我收到此错误:
(org.springframework.web.multipart.MultipartHttpServletRequest) throws
java.lang.Exception]; nested exception is java.lang.IllegalStateException: Current
request is not of type [org.springframework.web.multipart.MultipartHttpServletRequest]:
我做错了什么?
【问题讨论】:
-
你有没有在spring配置中配置了
MultipartResolver -
@Arun 是的。我以前用 jquery.fileupload 做过这个,但现在我需要用别的东西。
-
事实上,我的 applicationContext 中有这个。
-
使用的是哪个浏览器?您可以使用 IE
-
我试过 Chrome、FF、IE 11。同样的错误。我没有 IE
标签: jquery spring forms http-post