package com.tubeonfire.controller.admin;
import java.io.IOException;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.tubeonfire.entity.Feedback;
import com.tubeonfire.model.admin.FeedbackModel;
@SuppressWarnings("serial")
public class ViewFeedbackServlet extends HttpServlet {
private static final Logger log = Logger
.getLogger(ViewFeedbackServlet.class.getName());
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException, ServletException {
try {
HttpSession session = req.getSession();
String id = req.getParameter("id");
Feedback obj = FeedbackModel.getById(id);
if (obj != null) {
obj.setStatus(2);
FeedbackModel.insert(obj);
FeedbackModel.clearModelCache();
req.setAttribute("obj", obj);
req.getRequestDispatcher("/admin/view_feedback.jsp").forward(
req, resp);
} else {
session.setAttribute("error",
"Page's not exists or has been deleted !");
resp.sendRedirect("/admin/feedback/list");
}
} catch (Exception e) {
log.warning(e.toString());
e.printStackTrace();
resp.sendError(4004,
"We are sorry for the inconvenience ! Please try again later !");
}
}
}