public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException 
	{
		// ȡӦֵд뵽ļ
		request.setCharacterEncoding("UTF-8");
		String name = request.getParameter("name");
		String pwd = request.getParameter("pwd");
		String number = request.getParameter("number");
		String id = request.getParameter("id");
		String department = request.getParameter("department");
		String type = request.getParameter("type");
		
		Employee e = new Employee();
		e.setName(name);
		e.setPassword(pwd);
		e.setNumber(number);
		e.setId(Integer.parseInt(id));
		e.setDepartment(department);
		e.setPosition(type);
		
		// ȡʵ·
		String realPath = this.getServletContext().getRealPath("index.jsp");
		int end = realPath.lastIndexOf("/");
		realPath = realPath.substring(0, end+1);
				
		String folder = realPath + "EmployeeData";
		String message = "";
		
		// ļ
		FolderUtil.createFolder(folder);
		String filepath = folder + "/" + id;
		FileUtil.writeObject(filepath, e);
		

		// ԶȡԱб
		
		List<String> fileList = FileUtil.getAllFiles(folder);		
		for (int i = 1; i <= fileList.size(); i++)
		{
			Employee aread = FileUtil.readEmployee(folder + "/" + fileList.get(i-1));
			
			message += "<tr><td>Ա" + i + ":</td>";
			message += "<td>"+ aread.getId() + "/" + aread.getName() + "/" + aread.getNumber() + "/" + aread.getPosition() + "/" + aread.getDepartment() +  "</td></tr>";
		}		

		response.setContentType("text/html");
		// 
		response.setCharacterEncoding("UTF-8");
		response.setHeader("content-type","text/html;charset=UTF-8");
		
		PrintWriter out = response.getWriter();
		out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
		out.println("<HTML>");
		out.println("  <HEAD><TITLE>ӹԱ</TITLE></HEAD>");
		out.println("  <BODY>");
		out.println("<table align=\"center\">");
		out.println("<tr><td colspan=\"2\"> <h1>ӹԱɣǰĹԱбΪ</h1></td></tr>");
		out.println("<tr><td colspan=\"2\"> <h2>ļ洢е</h2></td></tr>");
		out.println("<tr><td colspan=\"2\">ID//˺//</td></tr>");
		out.println(message);
		out.println("<tr><td colspan=\"2\"> <h2>ݿе</h2></td></tr>");
		
		Connection conn=null;
        Statement stmt=null;
        ResultSet rs = null;
		
		try 
		{
			Class.forName("com.mysql.jdbc.Driver");
			String url = "jdbc:mysql://localhost:3306/bms";
			conn = DriverManager.getConnection(url, "root", "wang33");
			stmt = conn.createStatement();
		
			stmt.execute("insert into employee values (" + e.getId()+ ",'" + e.getName() + "','" + e.getNumber() + "','" + e.getPassword() + "','" + e.getDepartment() + "','" + e.getPosition() + "')");

			// ȡµļ¼
			rs = stmt.executeQuery("select * from employee");
			int i = 1;
			while (rs.next())
			{
				out.println("<tr><td>Ա" + i + ":</td>");
				out.println("<td>" + rs.getInt("id") + "/" + rs.getString("name") + "/" + rs.getString("number") + "/" + rs.getString("department") + "/" + rs.getString("position") + "</td></tr>");
				i++;
			}  
		} 
		catch (SQLException ee) 
		{
		   // TODO Auto-generated catch block
			out.println("SQLException"+ ee.toString()+ "<br/>");
		}
		catch(ClassNotFoundException ce)
        {
			out.println("ݿʧ<br/>");
			out.println(ce.toString()+ "<br/>");
        }
		
		
		out.println("<tr><td colspan=\"2\"><input type=\"button\" value=\"\" onclick=\"javascript:history.go(-1);\"/></td></tr>");
		out.println("</table>");
		out.println("  </BODY>");
		out.println("</HTML>");
		out.flush();
		out.close();
	}