前言
我们在登录网页的时候有时候会见到有几个字叫十天内免登陆复选框,比如126邮箱的登录页面
实现:
这里我们就要使用Cookie技术,Cookie技术是Web开发中必备的技术之一。
先开看下我的项目结构,下面直接贴代码,代码里面有详细的注释。
登录页面index.html
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> <!--login指向的是配置文件--> <form action="/你的项目名/login" method="post"> 账号 <input type="text" name="username"><br> 密码 <input type="password" name="password"><br> <input type="checkbox" name="tenDayLogin" value="ok">十天内免登陆<br> 登录 <input type="submit" value="登录"> </form> </body> </html>