jQuery写的ajax与servlet和数据库交互实现登录
-
首先这是大体流程思路
之前也写过但是不完善,这次用的maven工程.还对session,Cookie都设置了过期时间
而且前台用的jQuery+ajax. -
前台页面
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
</head>
<body>
<div id="show"></div>
<form id="log">
用户名:<input type="text" name="username" id="username"/>
密码:<input type="password" name="username" id="password"/>
</form>
<button id="login">登录</button>
</body>
<script>