问题解决了,我修改了返回类型为setContentType("text/html")可以正确解析了,感到很奇怪,其他的地方使用
setContentType("application/Json")都没问题,就上传的返回有问题了。
success:function(){}这里的解析是extJS解析收到的返回json后才会执行的,如果你的json字符串有问题,这里是不会执行的,好了结贴了。

try {
			ServletActionContext.getResponse().setCharacterEncoding("utf-8");
			ServletActionContext.getResponse().setContentType("text/html");  
			if(success==true){
				ServletActionContext.getResponse().getWriter().write("{\"success\":true}");
			} else {
				ServletActionContext.getResponse().getWriter().write("{\"success\":false}");
			}
		} catch (IOException e) {
			e.printStackTrace();
		}

 struts2的配置不在配返回值

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-09
  • 2021-12-09
  • 2021-05-20
  • 2021-10-19
  • 2022-12-23
相关资源
相似解决方案