|
@ -49,7 +49,7 @@ public class EnvDataServlet extends HttpServlet {
|
49
|
49
|
req.setCharacterEncoding("UTF-8");
|
50
|
50
|
res.setCharacterEncoding("UTF-8");
|
51
|
51
|
}
|
52
|
|
res.setContentType("application/json");
|
|
52
|
res.setContentType("text/html");
|
53
|
53
|
PrintWriter out = res.getWriter();
|
54
|
54
|
try {
|
55
|
55
|
String param = req.getParameter("bt");
|
|
@ -75,9 +75,25 @@ public class EnvDataServlet extends HttpServlet {
|
75
|
75
|
JsonService.write(e, out);
|
76
|
76
|
return;
|
77
|
77
|
}
|
78
|
|
out.write("{\"success\":true,\"data\":");
|
79
|
|
JsonService.toJson(result, out);
|
80
|
|
out.write("}");
|
|
78
|
out.write("<!DOCTYPE html><html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head><body>");
|
|
79
|
out.write("<table border=\"1\">\n" +
|
|
80
|
"<tr>\n" +
|
|
81
|
" <td>id</td>\n" +
|
|
82
|
" <td>显示内容</td>\n" +
|
|
83
|
" <td>单位</td>\n" +
|
|
84
|
" <td>值</td>\n" +
|
|
85
|
" <td>更新时间</td>\n" +
|
|
86
|
"</tr>");
|
|
87
|
for (Map<String, Object> map : result) {
|
|
88
|
out.write("<tr>\n" +
|
|
89
|
" <td>" + map.get("item_id") + "</td>\n" +
|
|
90
|
" <td>" + map.get("caption") + "</td>\n" +
|
|
91
|
" <td>" + map.get("unit") + "</td>\n" +
|
|
92
|
" <td>" + map.get("item_value") + "</td>\n" +
|
|
93
|
" <td>" + map.get("item_time") + "</td>\n" +
|
|
94
|
"</tr>");
|
|
95
|
}
|
|
96
|
out.write("</table></body></html>");
|
81
|
97
|
}
|
82
|
98
|
|
83
|
99
|
public List<Map<String, Object>> query(Connection con, final String bt, final String et) throws SQLException {
|