// 給客戶端返回一個json對象
StringBuilder sb = new StringBuilder("{");
sb.append("\"name\"").append(":").append(user.getName());
sb.append(",");
sb.append("\"gender\"").append(":").append(user.getGender());
sb.append("}");json
resp.getWriter().print(sb);app