Ejemplo n.º 1
0
 public String sendapplybyid() {
   User u = (User) ActionContext.getContext().getSession().get("loginUser");
   ServletActionContext.getResponse().setContentType("text/xml;charset=UTF-8");
   if (entity.getId().equals(u.getId())) {
     this.getWriter().print("您不能添加自己为好友!");
   } else if (dao.friendApply(IDUtil.generateId(), u.getId(), entity.getId())) {
     this.getWriter().print("发送成功");
   } else {
     this.getWriter().print("发送失败!");
   }
   return null;
 }
Ejemplo n.º 2
0
 public String sendApply() {
   User u = (User) ActionContext.getContext().getSession().get("loginUser");
   ServletActionContext.getResponse().setContentType("text/xml;charset=UTF-8");
   String id = null;
   if (u.getName().equals(uname)) {
     this.getWriter().print("您不能添加自己为好友!");
   } else if ((id = dao.checkIfExists(uname)) == null) {
     this.getWriter().print("该好友不存在!");
   } else if (dao.friendApply(IDUtil.generateId(), u.getId(), id)) {
     this.getWriter().print("发送成功");
   } else {
     this.getWriter().print("发送失败!");
   }
   return null;
 }