怎么在里面添加一个输入id和确认密码的功能,在哪加,对代码不了解

 <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" errorPage="error.jsp"%>
<%@ page import= "edu.jmi.db.*" %>
<%@ page import= "edu.jmi.dao.*" %>
<%@ page import= "java.sql.*" %>

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
        <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
        <title>Custom Login Form Styling</title>
        <meta name="description" content="Custom Login Form Styling with CSS3" />
        <meta name="keywords" content="css3, login, form, custom, input, submit, button, html5, placeholder" />
        <meta name="author" content="Codrops" />
        <link rel="shortcut icon" href="../favicon.ico"> 
        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <script src="js/modernizr.custom.63321.js"></script>
        <!--[if lte IE 7]><style>.main{display:none;} .support-note .note-ie{display:block;}</style><![endif]-->
        <style> 
            @import url(http://fonts.googleapis.com/css?family=Raleway:400,700);
            body {
                background: #7f9b4e url(images/bg2.jpg) no-repeat center top;
                -webkit-background-size: cover;
                -moz-background-size: cover;
                background-size: cover;
            }
            .container > header h1,
            .container > header h2 {
                color: #fff;
                text-shadow: 0 1px 1px rgba(0,0,0,0.7);
            }
        </style>
    </head>
    <body>
    <%
      request.setCharacterEncoding("UTF-8"); //设置编码
      String name=request.getParameter("login"); //获取用户名
      String pw = request.getParameter("password");
      if(session.getAttribute("usr")!=null){
          response.sendRedirect("main.jsp");
          return;
      }

         if(name!=null){ //保证有输入值,第一次访问页面该值页面为null
             //String dbpw=DB.validUser(name);//从数据库获取密码
             UserDao ud=new UserDao();
             String dbpw=ud.validUser(name);
             if(dbpw!=null&&dbpw.equals(pw)){//登录成功
          //设置传给主页面的参数:用户名
          session.setAttribute("usr", name);
          //进入主页面 
          response.sendRedirect("main.jsp");
      }else{//登录出错
          //设置出错参数
          session.setAttribute("errmsg", "用户名或者密码错,请重新输入");
      }
     }
      String err = (String)session.getAttribute("errmsg");
      if(err==null){
          err="";
      }

    %>
        <div class="container">


            <header>

                <h1>登录界面</h1>


            </header>

            <section class="main">
            <p>
            <font color="red" size="28px"> <%=err %> </font>
            </p>
                <form class="form-4" method="post">

                    <p>
                        <label for="login">用户名或者邮箱</label>
                        <input type="text" name="login" placeholder="login" required>
                    </p>
                    <p>
                        <label for="password">密码</label>
                        <input type="password" name="password" placeholder="password" required > 
                    </p>

                    <p>
                        <input type="submit" name="submit" value="提交">
                    </p>       
                </form>​
            </section>

        </div>
    </body>
</html>

确认密码可以在失去焦点时验证,使用ajax
输入id是什么意思?

你是要做一个注册功能吧???

input输入id就好啦,他有一个隐藏hidden属性的

验证密码用ajax可以同步验证返回结果,不过我看你前面验证用户名是否存在都没有用ajax而是用源生代码,那你验证也可以用源生代码写的