www.pudn.com > Jsp-Blog.rar > DelLogServlet.java, change:2010-05-26,size:1007b


package myblog.servlet; 
 
import java.io.IOException; 
import java.sql.SQLException; 
 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
 
import myblog.dao.DelLogDao; 
 
public class DelLogServlet extends HttpServlet { 
 
	public void doPost(HttpServletRequest request, HttpServletResponse response) { 
		String logid = request.getParameter("logid"); 
		DelLogDao delLog = new DelLogDao(); 
		try { 
			int num = delLog.deleteLog(logid); 
			if (num == 1) { 
				request.setAttribute("modifylogmsg", "删除成功!"); 
			} else { 
				request.setAttribute("modifylogmsg", "删除失败!"); 
			} 
		} catch (SQLException e) { 
			e.printStackTrace(); 
		} 
		try { 
			request.getRequestDispatcher("favourite.jsp").forward(request,response); 
		} catch (ServletException e) { 
 
			e.printStackTrace(); 
		} catch (IOException e) { 
 
			e.printStackTrace(); 
		} 
 
	} 
}