程序功能如下: 在页面中输入http://localhost:8080/add.jsp网址,打开添加数据页面。 输入相关数据后,完成添加功能。 程序部分代码如下(本程序只列出核心代码),请根据功能要求,补全程序。 1.add.jsp Title 填空1______" method="post"> 用户名: 密码: 填空2______"> 邮箱: 出生日期: 2.UserDao内容 public class UserDao { // 添加用户的操作 public boolean insert(User user) { Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; try { // 获得数据的连接 conn = JDBCUtils.getConnection(); // 发送SQL语句 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String birthday = sdf.format(__ 填空3_ ____.getBirthday()); String sql = " INSERT INTO users(NAME,PASSWORD,email,birthday) VALUES(?,?,?,?)"; // 获得Statement对象 stmt = conn.prepareStatement(__填空4___); stmt.setString(1,user.getUsername()); stmt.setString(2,user.getPassword()); stmt.setString(3,user.getEmail()); stmt.setString(4,__填空5_____ ); int num = stmt.executeUpdate(); if (num > 0) { return true; } return false; } catch (Exception e) { e.printStackTrace(); } finally { JDBCUtils.release(rs, stmt, conn); } return false; } } 3. AddServlet @WebServlet("/AddServlet") public class AddServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); PrintWriter out=___ 填空6_ ____.getWriter(); request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); String username=request.getParameter("___ 填空7_ ______"); String password=request.getParameter("password"); String email=request.getParameter("email"); SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd"); Date birthday=null; try { birthday=simpleDateFormat.parse(request.getParameter("birthday")); } catch (ParseException e) { e.printStackTrace(); } ___ 填空8_ ___ user=new User(); user.setUsername(username); user.setPassword(password); user.setBirthday(birthday); user.setEmail(email); UserDao __ 填空9__ _____=new __ 填空10_ ____; if(uDao.insert(user)){ out.println("添加成功"); }else { out.print("添加失败"); } } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } }