public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   response.setCharacterEncoding("UTF-8");
   request.setCharacterEncoding("UTF-8");
   response.setContentType("text/html");
   PrintWriter out = response.getWriter();
   String teacherId = request.getParameter("teacherId");
   String userId = request.getParameter("userId");
   if (StringUtil.isInteger(userId)) {
     int uId = Integer.parseInt(userId);
     if (StringUtil.isInteger(teacherId)) {
       int tId = Integer.parseInt(teacherId);
       querryIsAttention(uId, tId);
       if (attention == null) {
         result = JsonUtil.getRetMsg(3, "您还没关注");
       } else {
         result = JsonUtil.getRetMsg(0, "已经关注");
       }
     } else {
       result = JsonUtil.getRetMsg(1, "讲师id数字格式化异常");
     }
   } else {
     result = JsonUtil.getRetMsg(2, "您还没登陆");
   }
   out.print(result);
   out.flush();
   out.close();
 }
Пример #2
0
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   response.setCharacterEncoding("UTF-8");
   request.setCharacterEncoding("UTF-8");
   response.setContentType("text/html");
   PrintWriter out = response.getWriter();
   String videoId = request.getParameter("videoId");
   if (StringUtil.isInteger(videoId)) {
     int id = Integer.parseInt(videoId);
     initVideoDetaile(id);
     if (video != null) {
       result = JsonUtil.getVideoDetaile(video);
     } else {
       result = JsonUtil.getRetMsg(3, "获取视频详细信息失败");
     }
   } else {
     result = JsonUtil.getRetMsg(1, "视频id参数数字格式化异常");
   }
   out.print(result);
   out.flush();
   out.close();
 }