package com.multysite.ajax.admin;
import java.io.IOException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.multysite.entity.News;
import com.multysite.model.NewsModel;
@SuppressWarnings("serial")
public class ProcessNews extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException {
try {
String action = request.getParameter("action");
if (action != null && action.equals("delete")) {
String alias = request.getParameter("alias");
News obj = NewsModel.getById(alias);
if (obj != null) {
NewsModel.delete(obj);
response.getWriter().println("Done");
} else {
response.getWriter().println("This News is not exits");
}
}
} catch (Exception e) {
response.getWriter().println(
"Error when processing, please try again later !");
}
}
}