use of com.zyf.dao.RelaDao in project HeartWatchdogJsp by Viczyf.
the class RelaServlet method relaDelete.
private void relaDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String messages = "";
String forward = "";
String href = "";
RelaDao reladao = new RelaDao();
HttpSession session = request.getSession();
User user = (User) session.getAttribute("user");
int uid = user.getUid();
int id = MyTools.strToint(request.getParameter("id"));
boolean rs = reladao.relaDelete(id, uid);
if (rs) {
messages = "您已成功删除该好友";
forward = "tishi.jsp";
href = "RelaServlet?action=RelaList";
} else {
// messages = "删除好友失败,请稍后重试或检查该用户是否已经删除";
messages = "删除失败,请返回检查";
forward = "tishi.jsp";
href = "RelaServlet?action=RelaList";
}
request.setAttribute("message", messages);
request.setAttribute("href", href);
RequestDispatcher requestDispatcher1 = request.getRequestDispatcher(forward);
requestDispatcher1.forward(request, response);
}
Aggregations