www.pudn.com > Jsp-Blog.rar > UpdateLogServlet.java, change:2010-05-25,size:1094b


package myblog.servlet; 
 
import java.io.IOException; 
 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
 
import myblog.dao.LogDao; 
import myblog.dao.UpdateLogDao; 
 
public class UpdateLogServlet extends HttpServlet { 
 
	protected void doPost(HttpServletRequest request, 
			HttpServletResponse response) { 
		String logid = request.getParameter("logid"); 
		String logtitle = request.getParameter("logtitle"); 
		String logcontent = request.getParameter("logcontent").trim(); 
		UpdateLogDao log = new UpdateLogDao(); 
		int num = log.logUpdate(logtitle, logcontent, logid); 
		if (num == 1) { 
			request.setAttribute("logupdatemsg", "日志已更新!"); 
		} else { 
			request.setAttribute("logupdatemsg", "日志更新失败!"); 
		} 
		try { 
			request.getRequestDispatcher("modifylog.jsp").forward(request, response); 
		} catch (ServletException e) { 
 
			e.printStackTrace(); 
		} catch (IOException e) { 
 
			e.printStackTrace(); 
		} 
	} 
 
}