编写JsonResult封装JSON返回值 package cn.tedu.note.util; import java.io.Serializable; import cn.tedu.note.service.UserNotFoundException; public class JsonResult implements Serializable{ public static final int SUCCESS = 0; public static final int ERROR = 1;
import java.io.Serializable; public class JsonResult implements Serializable{ private static final long serialVersionUID = -4800793124936904868L; public static final int SUCCESS=200; public static final int ERROR=201; /** * 返回是否成功的状态,200表示成功, * 201或其
在使用MVC的时候我们经常会在Controller的Action方法中返回JsonResult对象,但是有时候你如果序列化的对象太大会导致JsonResult从Controller的Action返回后抛出异常,显示Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJso
将所有返回JsonContent对象进行再次封装 public class ResultFilterAttribute : System.Web.Mvc.ActionFilterAttribute { public override void OnActionExecuted(ActionExecutedContext filterContext) { if (filterContext.Exception != null) { base.OnActionExecuted(filterConte