org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: java.lang.reflect.InvocationTargetException
org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:243)
org.apache.struts2.json.JSONWriter.process(JSONWriter.java:165)
org.apache.struts2.json.JSONWriter.value(JSONWriter.java:131)
org.apache.struts2.json.JSONWriter.write(JSONWriter.java:99)
org.apache.struts2.json.JSONUtil.serialize(JSONUtil.java:112)
org.apache.struts2.json.JSONResult.execute(JSONResult.java:198)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
com.opensymphony.xwork2.interceptor.Defaul…
今天使用ajax请求后台数据的时候总是进入error函数,查看后台明明返回的是一切正常的返回但就是进不了success函数
后台也没有任何报错信息,于是打开google的Network看了一下发现里面出了错 是struts2在处理返回数据的时候出了问题
把错误贴在网上 说是因为get set方法出了问题 于是检查了一下get set方法
发现是因为 在使用 private HttpServletRequest request的时候 加了get方法 所以报错
顺便说一下 当想使用HttpServletRequest 但不想放在方法中做参数的时候 只需要类extends ActionSupport implements ServletRequestAware需要实现一个set方法就可以了
public void setServletRequest(HttpServletRequest request) {
this.request = request;
}