简单用户登录系统源代码——Servlet学习
刚刚开始学习前端,基本就是零基础,学习方法就是看网上的教程,然后从网上找一些源代码来练习。
下面的代码是我先看了Servlet实例登录(https://www.yiibai.com/servlet/example-of-login-form-in-servlet.html)中的例子,在此基础上自己联系了一下。
首先建一个项目,目录结构如下:
下面的代码是我先看了Servlet实例登录(https://www.yiibai.com/servlet/example-of-login-form-in-servlet.html)中的例子,在此基础上自己联系了一下。
首先建一个项目,目录结构如下:
![](https://i-blog.csdnimg.cn/blog_migrate/4e61b080b52c6143e38e4ac849d4963a.png)
首先是登录功能实现,这个是完全按照Servlet实例登录(https://www.yiibai.com/servlet/example-of-login-form-in-servlet.html)来写的,登录页面的html代码如下(可能有些细节不太一样,做后面的一些功能的时候添加或者修改了一些东西。另外这里的css不是重点,因此没有写,可以自己添加):
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>登录</title> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script> </head> <body> <div style="text-align:center;pandding-top:12px;"> <form action="login" method="post"><!-- action是入口,方法是post,post比get安全,如果不写method,默认get --> 用户名:<input type="text" name="name" /> 密码:<input type="password" name="password" /> <input type="submit" value="登录" /> <input type="reset" value="重置" /> </form> </div> <button style="position: absolute;left: 60%; padding-top: 12px" onclick="window.location.href='logon.html'">注册</button> </body> </html>
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
<a href="login.html">登录</a> <