`
JavaSam
  • 浏览: 934191 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

jquery .form.js 文件上传返回json与Strut2冲突的异常:提示下载

 
阅读更多

当用jqueryForm提交表单需要返回json类型的数据时,后台需要设置Response的contentType属性为“text/html”

但当我们使用Struts2Utils.renderJson(args)时就会提示下载,虽然我们设置了contentType属性,原因在于

Struts2Utils.renderJson(args)方法内部又设这了一遍contentType属性,如下

 HttpServletResponse response = initResponseHeader("application/json", headers);

它覆盖了我们的设置,所以要想用jqueryForm 返回json就只能我们手动拿到Writer自己print了

0
3
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics