From b197f57e3e86f3f2e74dfd406c974ffe8c4c4a8b Mon Sep 17 00:00:00 2001 From: User_cyk <1020691186@qq.com> Date: Sun, 2 Jul 2023 13:46:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0JSON?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/servlet/countNumServlet.java | 1 + src/com/hellogithub/servlet/userNumServlet.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/hellogithub/servlet/countNumServlet.java b/src/com/hellogithub/servlet/countNumServlet.java index 3bd5db4..7cc702f 100644 --- a/src/com/hellogithub/servlet/countNumServlet.java +++ b/src/com/hellogithub/servlet/countNumServlet.java @@ -41,6 +41,7 @@ public class countNumServlet extends HttpServlet { PrintWriter writer = resp.getWriter(); String str= String.valueOf(projectService.countAll()); + str="{num:"+str+"}"; String jsonString = JSONObject.toJSONString(str); writer.println(jsonString); writer.close(); diff --git a/src/com/hellogithub/servlet/userNumServlet.java b/src/com/hellogithub/servlet/userNumServlet.java index 1030075..fe70152 100644 --- a/src/com/hellogithub/servlet/userNumServlet.java +++ b/src/com/hellogithub/servlet/userNumServlet.java @@ -41,7 +41,7 @@ public class userNumServlet extends HttpServlet { PrintWriter writer = resp.getWriter(); long num = userService.queryUserCount(); - String str= "num:"+num ; + String str= "{num:"+num+"}" ; String jsonString = JSONObject.toJSONString(str); writer.println(jsonString); if(num == 0)