package com.action;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;
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.bean.ComBean;
import com.util.Constant;
public class ComServlet extends HttpServlet {
	/**
	 * Constructor of the object.
	 */
	public ComServlet() {
		super();
	}
	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}
	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request,response);
	}
	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType(Constant.CONTENTTYPE);
		request.setCharacterEncoding(Constant.CHARACTERENCODING);
		HttpSession session = request.getSession();
		ComBean cBean = new ComBean();
		String date=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
		String date2=new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
		String method = request.getParameter("method");
		 
		
		 if(method.equals("addlj")){ //  
			String mc = request.getParameter("mc");  
			String dz = request.getParameter("dz");   
				int flag=cBean.comUp("insert into lj(mc,dz  ) values('"+mc+"','"+dz+"'  ) ");
				if(flag == Constant.SUCCESS){ 
					request.setAttribute("message", "²Ù×÷³É¹¦£¡");
					request.getRequestDispatcher("admin/lj/index.jsp").forward(request, response); 
				}
				else { 
					request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
					request.getRequestDispatcher("admin/lj/index.jsp").forward(request, response);  
				}
			 
		} 
		else if(method.equals("uplj")){  // 
			String id = request.getParameter("id");  
			String mc = request.getParameter("mc");  
			String dz = request.getParameter("dz");   
			int flag=cBean.comUp("update lj set mc='"+mc+"',dz='"+dz+"' where id='"+id+"' ");
			if(flag == Constant.SUCCESS){ 
				request.setAttribute("message", "²Ù×÷³É¹¦£¡");
				request.getRequestDispatcher("admin/lj/index.jsp").forward(request, response);  
			}
			else { 
				request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
				request.getRequestDispatcher("admin/lj/index.jsp").forward(request, response);  
			}
		}
		else if(method.equals("dellj")){   
			String id = request.getParameter("id");   
			int flag=cBean.comUp("delete from lj where id='"+id+"' ");
			if(flag == Constant.SUCCESS){ 
				request.setAttribute("message", "²Ù×÷³É¹¦£¡");
				request.getRequestDispatcher("admin/lj/index.jsp").forward(request, response);  
			}
			else { 
				request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
				request.getRequestDispatcher("admin/lj/index.jsp").forward(request, response);  
			}
		} 
		else if(method.equals("delss")){   
			String id = request.getParameter("id");   
			int flag=cBean.comUp("delete from keyword where id='"+id+"' ");
			if(flag == Constant.SUCCESS){ 
				request.setAttribute("message", "²Ù×÷³É¹¦£¡");
				request.getRequestDispatcher("member/ss/index.jsp").forward(request, response);  
			}
			else { 
				request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
				request.getRequestDispatcher("member/ss/index.jsp").forward(request, response);  
			}
		} 
		 
	}
	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occure
	 */
	public void init() throws ServletException {
		// Put your code here
	}
}
 最近下载更多
最近下载更多
                
                郭宇航裹裹     LV5
                2024年6月10日
            
            
        
                xk16675552250     LV33
                2024年1月8日
            
            
        
                zhangjilu     LV18
                2024年1月1日
            
            
        
                独家子弟     LV14
                2023年8月23日
            
            
        
                ziv5466123     LV7
                2023年6月20日
            
            
        
                addfs55     LV1
                2023年3月6日
            
            
        
                chen_jw     LV10
                2023年2月20日
            
            
        
                485415187     LV6
                2022年11月20日
            
            
        
                testuser1234567     LV24
                2022年7月21日
            
            
        
                403401     LV2
                2022年6月24日
            
            
         最近浏览更多
最近浏览更多
                
                zxy111111    
                6月8日
            
            
                    暂无贡献等级
            
        
                ZzzxzzZ     LV6
                4月11日
            
            
        
                微信网友_7005050423463936    
                2024年12月2日
            
            
                    暂无贡献等级
            
        
                shunlun8855     LV1
                2024年10月28日
            
            
        
                微信网友_7055535282196480    
                2024年6月27日
            
            
                    暂无贡献等级
            
        
                TY0165     LV20
                2024年6月24日
            
            
        
                高李杰     LV2
                2024年6月21日
            
            
        
                206031487    
                2024年6月19日
            
            
                    暂无贡献等级
            
        
                郭宇航裹裹     LV5
                2024年6月10日
            
            
        
                港港hhhhhh     LV1
                2024年5月20日
            
            
        
 
                 
     
                