小弟刚学jquery 不明白他的回调函数 是如何回调的
请看下代码
private void toJSONData(Object obj, final String[] exclusionField,
String timeformat) {
JsonConfig config = this.configJson(exclusionField, timeformat);
JSON json = null; try {
JSONResponse data = null;
if (obj instanceof JSONResponse)
data = (JSONResponse) obj;
Object objData = data.getData();
// map集合的转换,
if (null != objData
&& ("java.util.HashMap").equals(objData.getClass()
.getName())) {
Map objMap = (Map) objData;
String result = "{\"data\":{";
for (Object key : objMap.keySet()) {
if (("java.lang.String").equals(key.getClass().getName())) {
result += "\"" + key.toString() + "\":";
if (("java.lang.String").equals(objMap.get(key)
.getClass().getName())) {
result += "\"" + objMap.get(key).toString() + "\"";
} else {
result += JSONSerializer.toJSON(objMap.get(key),
config).toString();
}
result += ",";
} else {
result += "\""
+ JSONSerializer.toJSON(key, config).toString()
+ "\":";
if (("java.lang.String").equals(objMap.get(key)
.getClass().getName())) {
result += "\"" + objMap.get(key).toString() + "\"";
} else {
result += JSONSerializer.toJSON(objMap.get(key),
config).toString();
}
result += ",";
}
}
result = result.substring(0, result.length() - 1);
result += "},\"msg\":\"" + data.getMsg() + "\"}";
this.jsonStr = new ByteArrayInputStream(
result.getBytes("UTF-8"));
} else {
json = JSONSerializer.toJSON(obj, config);
this.jsonStr = new ByteArrayInputStream(json.toString()
.getBytes("UTF-8"));
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}this.jsonStr = new ByteArrayInputStream(json.toString() 请问 这行代码 是不是 就是向前台传送的对象 转换成了json $.post("content/notice/notice_getNoticeList", arr, function(data){},json)我当前的data 的类型是 jsonResponse 这个类是自己写的 他的回调时候的函数 为何是 这个类呢?
请看下代码
private void toJSONData(Object obj, final String[] exclusionField,
String timeformat) {
JsonConfig config = this.configJson(exclusionField, timeformat);
JSON json = null; try {
JSONResponse data = null;
if (obj instanceof JSONResponse)
data = (JSONResponse) obj;
Object objData = data.getData();
// map集合的转换,
if (null != objData
&& ("java.util.HashMap").equals(objData.getClass()
.getName())) {
Map objMap = (Map) objData;
String result = "{\"data\":{";
for (Object key : objMap.keySet()) {
if (("java.lang.String").equals(key.getClass().getName())) {
result += "\"" + key.toString() + "\":";
if (("java.lang.String").equals(objMap.get(key)
.getClass().getName())) {
result += "\"" + objMap.get(key).toString() + "\"";
} else {
result += JSONSerializer.toJSON(objMap.get(key),
config).toString();
}
result += ",";
} else {
result += "\""
+ JSONSerializer.toJSON(key, config).toString()
+ "\":";
if (("java.lang.String").equals(objMap.get(key)
.getClass().getName())) {
result += "\"" + objMap.get(key).toString() + "\"";
} else {
result += JSONSerializer.toJSON(objMap.get(key),
config).toString();
}
result += ",";
}
}
result = result.substring(0, result.length() - 1);
result += "},\"msg\":\"" + data.getMsg() + "\"}";
this.jsonStr = new ByteArrayInputStream(
result.getBytes("UTF-8"));
} else {
json = JSONSerializer.toJSON(obj, config);
this.jsonStr = new ByteArrayInputStream(json.toString()
.getBytes("UTF-8"));
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}this.jsonStr = new ByteArrayInputStream(json.toString() 请问 这行代码 是不是 就是向前台传送的对象 转换成了json $.post("content/notice/notice_getNoticeList", arr, function(data){},json)我当前的data 的类型是 jsonResponse 这个类是自己写的 他的回调时候的函数 为何是 这个类呢?
解决方案 »
- 判断URL是否有效,找了几天,有没有谁能给一个真正能用的
- 大家看看这个ant代码从A服务器拷贝到B服务器,哪里有问题
- 请高手指点一下
- 关于java的编码问题
- 在AIX下,Java怎么操作word文件的域?
- 关于jsp的一个问题
- 一个很简单的Applet问题
- 请教 dateadd 的问题
- index.htm页面中的form登陆递交到servlet中,登陆成功,这时IE的地址也变成了****/idc/login这样子,我想把IE的地址仍然停留在****/idc,如
- 用servlt访问oracle的lob(图象)问题
- struts2+spring3+mybatis的JAR包整合问题
- ssh条件查询分页,查询结果为空是抛异常,“只进结果集,不支持请求的操作”
这边文章说的是就是jquery如何使用回调函数
楼主的问题很模糊
建议下个jquery的API手册