1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.demo.kitchensink;
17
18 import javax.ws.rs.GET;
19 import javax.ws.rs.Path;
20
21
22
23
24
25
26
27 @Path("/")
28 public class DataTableRestServiceTestImpl {
29
30
31
32
33
34
35 @GET
36 @Path("/TableData")
37 public String getTableData() {
38 StringBuilder sb = new StringBuilder();
39
40 sb.append("{ \"aaData\": [\n");
41
42 for (int i = 0; i < 800; i++) {
43 sb.append("[\"CHEM " + i + "\",");
44
45 if (i % 10 == 0) {
46 String spanId = "nm_row_" + i;
47 sb.append("\"<span id='" + spanId + "'>INTRODUCTION TO GENERAL CHEMISTRY</span>");
48 sb.append("<input type='hidden' name='script' value=\\\"jQuery('#"
49 + spanId + "').attr('style', 'color:green');\\\"/>\"");
50 sb.append(",");
51 } else {
52 sb.append("\"INTRODUCTION TO GENERAL CHEMISTRY\",");
53 }
54 sb.append("\"3\",");
55 sb.append("\"AU\",");
56 sb.append("\"NW\",");
57 sb.append("\"Neal\",");
58 sb.append("\"MWF\",");
59 sb.append("\"300.00\",");
60 sb.append("\"3\",");
61 sb.append("\"100\"]");
62
63 if (i < 799) {
64 sb.append(",\n");
65 }
66 }
67
68 sb.append("\n] }");
69
70 return sb.toString();
71 }
72 }