SpringBoot实现简单的登录注册
项目创建步骤
一直下一步即可
(注:环境要求jdk1.8)
目录结构
数据库
//创建数据库
create database test;
//选择创建好的数据库,建立user表
t_user test;
create table t_user(
id int primary key auto_increment,
username varchar(32) unique not null,
password varchar(32) not null
);
//想创建好的数据库中添加数据
insert into t_user values(1,"xioming","000");
登录(login.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>login</title>
</head>
<body>
<form method="post" action="/user/login">
用户名:<input name="username" type="text"><br>
密码:<input name="password" type="password"><br>
<input type="submit" value="登录验证">
<input type="button" onclick="javascript:window.location.href='regist.html'" value="去注册页面">
</form>
</body>
</html>
注册界面(register.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form action="/user/regist" method="post">
用户名:<input type="text" name="username"><br>
密码:<input type="password" name="password"><br>
<input type="submit" value="注册验证"&