AJAX way:. $ Post system login check
https://blog.csdn.net/woshisangsang/article/details/66560238?utm_source=blogxgwz5
< Script type = "text / JavaScript" > function Login () { var the userId = $ ( " #userid " ) .val (); var the userPassword = $ ( " #userPassword " ) .val (); IF (the userId == = "" || the userPassword === "" ) { $ .messager.alert ( ' prompt ' , ' employee number and password can not be empty! ' , ' info '); return false; } $.post("/BankStatistics/LoginServlet?ran='+Math.random()", {userId:userId,userPassword:userPassword}, function(data){ var result = eval('('+data+')'); if (result.success===true){ window.location.href="main.jsp"; return to true ; } the else { $ .messager.alert ( ' prompt ' , ' employee ID or password is incorrect, please approve! ' , ' info ' ); return to false ; } } // function (Data) ); // $. POST } // Login () </ Script >