login.jsp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8"%>
  3. <%@ page isELIgnored="false" %>
  4. <!DOCTYPE html>
  5. <html lang="en">
  6. <head>
  7. <meta charset="utf-8">
  8. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9. <meta name="viewport" content="width=device-width,initial-scale=1">
  10. <meta name="description" content="">
  11. <meta name="author" content="">
  12. <title>登录员工部门管理系统</title>
  13. <!-- Bootstrap core css -->
  14. <link href="${pageContext.request.contextPath }/lib/css/bootstrap.min.css"
  15. rel="stylesheet">
  16. <!-- Custom style for this template -->
  17. <link href="${pageContext.request.contextPath }/lib/css/signin.css"
  18. rel="stylesheet">
  19. </head>
  20. <body>
  21. <div class="container">
  22. <form class="form-signin"
  23. action="${pageContext.request.contextPath }/signOn" method="post"
  24. onsubmit="return check()">
  25. <h2 class="form-signin-heading">员工部门后台系统登录</h2>
  26. <span style="color:red" id="message">${msg }</span>
  27. <label for="no" class="sr-only">用户账号</label>
  28. <input type="text" id="no" name="no" class="form-control" placeholder="
  29. 用户账号" required autofocus>
  30. <label for="password" class="sr-only">用户密码</label>
  31. <input type="password" id="password" name="password" class="form-control" placeholder="
  32. 用户密码" required>
  33. <div class="checkbox">
  34. <label>
  35. <input type="checkbox" value="remember-me" id="remember-me">记住我
  36. </label>
  37. </div>
  38. <button class="btn btn-lg btn-primary btn-block" type="submit">登录</button>
  39. <!-- <button class="btn btn-lg btn-primary btn-block" type="submit">注册</button> -->
  40. </form>
  41. </div><!-- /container -->
  42. <script src="${pageContext.request.contextPath }/lib/js/jquery.min.js"></script>
  43. <script src="${pageContext.request.contextPath }/lib/js/jquery.cookie.min.js"></script>
  44. <!-- 加载就执行 用于记住我功能 -->
  45. <script>
  46. $(document).ready(function(){
  47. if($.cookie('password')!=null){
  48. $("#password".val($.cookie("password")));
  49. }
  50. if($.cookie('no')!=null){
  51. $("#no".val($.cookie("no")));
  52. }
  53. });
  54. </script>
  55. <script>
  56. function check(){
  57. //记住我功能使用
  58. //写入cookie
  59. if($("#remember-me").prop("checked")==true){
  60. var no=$("#no").val();
  61. var password=$("#password").val();
  62. $.cookie('no',no,{expiree:7});
  63. $.cookie('password',password,{expiree:7});//存储一个带7天期限的cookie
  64. }else{
  65. $.cookie("no",null);
  66. $.cookie("password",null);
  67. }
  68. }
  69. </script>
  70. </body>
  71. </html>