package com.wxpn.tutorial.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class for Servlet: DeleteUserServlet
 */
public class DeleteUserServlet extends javax.servlet.http.HttpServlet implements
		javax.servlet.Servlet {
	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public DeleteUserServlet() {
		super();
	}

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request,
	 *      HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// 获取提交的用户名：
		String strUserName = request.getParameter("userName");
		UserMgr mgr = new UserMgr();
		mgr.delete(strUserName);
		try {
			request.getRequestDispatcher("UserListServlet").forward(
					request, response);
		} catch (Throwable t) {
			getServletContext().log(t.getMessage());
		}
	}
}