锘??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美精品一区二区精品网,中文字幕不卡在线视频极品,97色伦图片97色伦在线电影http://www.aygfsteel.com/Vanilla-Sky/category/46590.html閫愭ⅵ涔嬫梾zh-cnTue, 12 Oct 2010 11:50:16 GMTTue, 12 Oct 2010 11:50:16 GMT60- 涓涓猨Query 鍜宩son 欏甸潰浜や簰鐨勫疄渚?/title>http://www.aygfsteel.com/Vanilla-Sky/archive/2010/10/12/334679.html鏃犲敖嫻?/dc:creator>鏃犲敖嫻?/author>Tue, 12 Oct 2010 09:27:00 GMThttp://www.aygfsteel.com/Vanilla-Sky/archive/2010/10/12/334679.htmlhttp://www.aygfsteel.com/Vanilla-Sky/comments/334679.htmlhttp://www.aygfsteel.com/Vanilla-Sky/archive/2010/10/12/334679.html#Feedback0http://www.aygfsteel.com/Vanilla-Sky/comments/commentRss/334679.htmlhttp://www.aygfsteel.com/Vanilla-Sky/services/trackbacks/334679.html宸ヤ綔涓殑鐐規淮璁板綍...
No.1
jsp欏甸潰涓殑鑴氭湰浠g爜 闇瑕佸紩鍏?br />
<script type="text/javascript" src="${ctx}/js/jquery.js"></script>
1
<!--欏甸潰jquery鑴氭湰-->
2
3
function updateQuantity()
{
4
$.getJSON("${ctx}/do/material/updateQuantity?id="+$('#id').val()+"&quantity="+$('#quantity').val()+"×tamp="+new Date().getTime(),
5
function(data)
{
6
//閬嶅巻JSON涓殑姣忎釜entry
7
$.each(data,function(entryIndex,entry)
{
8
var html='<tr>';
9
//涔熷彲浠ュ啓鎴恊ntry.id entry.state
10
html+='<td>'+entry['id']+'</td>';
11
html+='<td>璧勬枡鐘舵?nbsp; '+entry['state']+'</td>';
12
html+='<td>'+entry['serialNumber']+'</td>';
13
html+='</tr>';
14
$('#title').html(html);
15
16
});
17
});
18
}
No.2
鍚庡彴controller浠g爜
1
/** *//**
2
* 灝嗕紶鍏ョ殑瀵硅薄杞寲涓篔SON鏁版嵁鏍煎紡
3
*/
4
protected JSONObject toJSONObject(Object obj) throws SecurityException, JSONException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException,
5
InvocationTargetException
{
6
JSONObject jobj = new JSONObject();
7
Field[] fields = obj.getClass().getDeclaredFields();
8
for (Field field : fields)
{
9
// 璇誨彇obj鍐呴儴鐨勫璞″睘鎬?
10
if (field.getName().equals("department"))
{
11
Object m = obj.getClass().getMethod("get" + StringUtils.capitalize("department")).invoke(obj);
12
jobj.put("id", m.getClass().getMethod("get" + StringUtils.capitalize("id")).invoke(m));
13
jobj.put("name", m.getClass().getMethod("get" + StringUtils.capitalize("name")).invoke(m));
14
continue;
15
}
16
// 榪囨護鎺塻et鎴愬憳鍙橀噺
17
if (field.getType().equals(Set.class))
{
18
continue;
19
}
20
// 鎴愬憳鍙橀噺鏄疍ate
21
if (field.getType().equals(Date.class))
{
22
Object invoke = obj.getClass().getMethod("get" + StringUtils.capitalize(field.getName())).invoke(obj);
23
String format = DateFormat.getDateInstance(DateFormat.DEFAULT).format(invoke);
24
// System.out.println(field.getName() + "===>" + format);
25
jobj.put(field.getName(), format);
26
continue;
27
}
28
// 鎴愬憳鍙橀噺鏄疊oolean
29
if (field.getType().equals(Boolean.class))
{
30
jobj.put(field.getName(), obj.getClass().getMethod("is" + StringUtils.capitalize(field.getName())).invoke(obj));
31
continue;
32
}
33
try
{
34
jobj.put(field.getName(), obj.getClass().getMethod("get" + StringUtils.capitalize(field.getName())).invoke(obj));
35
} catch (Exception e)
{
36
continue;
37
}
38
}
39
return jobj;
40
}
model杞瀷涓簀son鏁版嵁鏃訛紝鐢ㄤ簡鍙嶅皠瀵筸odel涓垚鍛樺彉閲忎負闆嗗悎(Set)銆丅oolean銆丏ate榪涜鐗規畩澶勭悊銆?br />
PS:json鏍煎紡
[{},
{ "name":"value", "name":"value",
"children":[{ "name":"value", "attributes":{ "url":"/do/postRequirement/postRequirementList" }},{ "name":"value", "attributes":{ "url":"/do/trainingPlan/trainingPlanList" } }]
},
{},{},{},{},{}]
json鏁翠綋鏍煎紡涓篬{},{},{}] ,鍐呴儴鏁版嵁涓烘鍩烘湰緇撴瀯鐨勫鍚堛倇}鍐呴儴鏈夐泦鍚堢粨鏋勶紝濡傦細children,涔熸槸浠]鏉ュ寘鍚傚唴閮ㄧ粨鏋勫悕縐版槸鑷畾鐨?涓漢鐞嗚В)銆?br />
璇︾粏鏍煎紡錛?a >http://www.json.org/json-zh.html

]]>
主站蜘蛛池模板:
衡南县|
金寨县|
新绛县|
安龙县|
长阳|
灌阳县|
建宁县|
大同市|
富平县|
辽宁省|
桑日县|
万荣县|
兰考县|
安多县|
依兰县|
安阳县|
昭觉县|
八宿县|
舞钢市|
东宁县|
新绛县|
盖州市|
财经|
延吉市|
平原县|
北流市|
新绛县|
台南县|
平果县|
延吉市|
敖汉旗|
来宾市|
横峰县|
璧山县|
望江县|
日土县|
集贤县|
屏南县|
大新县|
石渠县|
特克斯县|