package com.chen.news.control; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.chen.news.service.NewsService; /** * Servlet implementation class AdmServlet */ @WebServlet("/AdmServlet") public class AdmServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public AdmServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub request.setCharacterEncoding("UTF-8"); response.setContentType("text/html; charset=UTF-8"); System.out.println(request.getParameter("delete")); System.out.println(request.getParameter("update")); String delete = request.getParameter("delete"); String update = request.getParameter("update"); if(delete!=null && update==null) { ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml"); NewsService newsService = (NewsService) ac.getBean("NewsService"); newsService.deleteNews(Integer.parseInt(delete)); response.sendRedirect("/jspNews/admin.jsp"); } if(delete==null && update!=null) { request.getSession().setAttribute("update", update); response.sendRedirect("/jspNews/publish.jsp"); } } }

微信网友_7005760998215680 LV6
2024年10月2日
sadselect LV8
2024年6月28日
bankroll LV5
2024年6月13日
321170193 LV6
2023年11月14日
2063066273 LV2
2023年6月14日
1765672334 LV1
2023年6月2日
胡祖瑜 LV1
2023年4月30日
微信网友_5975606834761728 LV3
2023年3月21日
kks9580 LV6
2023年2月2日
zhunishimian LV6
2022年10月30日

krispeng LV15
5月29日
ma406805131 LV19
2024年12月19日
wzd031105 LV2
2024年12月6日
微信网友_7005760998215680 LV6
2024年10月2日
时光海 LV2
2024年6月30日
sadselect LV8
2024年6月28日
cong58cong LV8
2024年6月26日
15719908287 LV10
2024年6月19日
chenranr LV10
2024年6月15日
bankroll LV5
2024年6月12日