The request is often made to spring through a page, and the server finishes processing the data and returns the data to the JSP. Here are a few ways:
1. Return data directly to the JSP:
Be sure to add @ResponseBody to the method as follows:
Spring
Querying for bugs
@RequestMapping (params = "Method=querybug")
Public @ResponseBody string Querybug (String Serviceid, string starttime) {
o convert it to JSON-formatted data for data that needs to be returned ...
return Jsonarray.fromobject (O). toString ();
}
Jsp:
Iterate through the received data, I is the index, n if the object is the format of the N.id (N. Field name)
$.post ("Countbughandle.do?method=query", {menuId: $ (' #menuId '). Val (), Servid:servid,starttime:starttime,endtime: Endtime,combobox_type:combobox_type}, function (data) {$ ("#tr"). empty (); $.each (Data,function (i,n) {if (i==0) {var tr = $ ("<tr></tr>"); $.each (N,function (j) {if (j==0) {tr.append ("<td class= ' rows Grade_col_first ' >" +n[j ]+ "</td>");} Else{tr.append ("<td class= ' rows grade_col ' >" +n[j]+ "</td>");}}); $ ("#gamedatetable"). Append (tr);} Else{if (i%2==0) {var tr = $ ("<tr style= ' background: #e6eaf2; ' ></tr> "); $.each (N,function (j) {Tr.append (" <td class= ' rows ' > "+n[j]+" </td> ");}); $ ("#gamedatetable"). Append (tr);} Else{var tr = $ ("<tr></tr>"); $.each (N,function (j) {Tr.append ("<td class= ' rows ' >" +n[j]+ "</td > ");}); $ ("#gamedatetable"). Append (tr);}});}, "JSON");
Data transfer for spring and JSP ...