login(登录).jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
    <form action="${pageContext.request.contextPath}/login" οnsubmit="return check()">
        <table border="1px">
            <tr>
                <td>用户名:</td>
                <td><input type="text" name="uname" id="uname"></td>
            </tr>
            <tr>
                <td>密码:</td>
                <td><input type="password" name="pwd" id="pwd"></td>
            </tr>
            <tr>
                <td colspan="2"><input type="submit" value="登录"></td>
            </tr>
        </table>
    
    </form>
</body>
<script>
            function check()
            {
                var uname = document.getElementById("uname").value;
                var pwd = document.getElementById("pwd").value;
                if(uname==null || uname =='')
                {
                    alert("用户名不能为空!")
                    return false;
                }
                if(isNaN(Number(pwd)))
                {
                    alert("请输入正确的数量!")
                    return false;
                }
                return true;
            }
            
            
        </script>
</html>