好优扒网

2020.10.16-12节

好优扒网 http://www.haou8.com 2020-10-16 09:26 出处:网络 编辑:@admin
用户登录代码login.jsp <%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD
  1. 用户登录代码login.jsp


  2. <%@ page language="java" contentType="text/html; charset=UTF-8"

  3.     pageEncoding="UTF-8"%>

  4. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  5. <html>

  6. <head>

  7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  8. <title>XXX系统登录</title>

  9. <script>

  10. function loginform_check(){

  11. var flag=true;

  12. //自行补充完整

  13. return flag;

  14. }

  15. function User_Reg(){

  16. window.location="user_reg.jsp";

  17. }

  18. </script>

  19. </head>

  20. <body>

  21. <form id="login_form" name="login_form" action="login_action.jsp" method="post" 

  22. onsubmi="return loginform_check()">

  23. <table align=center>

  24. <tr>

  25. <td colspan="2" align="center">账号登录</td>

  26. </tr>

  27. <tr>

  28. <td>账号</td>

  29. <td>

  30. <input type="text" name="userid" id="userid" >

  31. </td>

  32. </tr>

  33. <tr>

  34. <td>密码</td>

  35. <td>

  36. <input type="password" name="pass" id="pass" >

  37. </td>

  38. </tr>

  39. <tr>

  40. <td colspan=2 align=center>


  41. <input type="submit" id="action" name="action" value="登录">

  42. <input type="button" id="register" name="register" value="注册" onclick="User_Reg()">

  43. </td>

  44. </tr>

  45. </table>

  46. </form>

  47. </body>

  48. </html>



  49. 用户登录处理代码login_action.jsp

  50. <%@ page language="java" contentType="text/html; charset=UTF-8"

  51.     pageEncoding="UTF-8"%>

  52. <%@ page import="java.sql.*" %>

  53. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  54. <html>

  55. <head>

  56. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  57. <title>Insert title here</title>

  58. </head>

  59. <body>

  60. <%!

  61. public boolean Login_Process(String userid,String pass,String coding){

  62. boolean flag=false;

  63. if(userid!=null && userid.equals("123456") && pass!=null && pass.equals("abc"))

  64. flag=true;

  65. return flag;

  66. }


  67. %>

  68. <%

  69. String userid="";

  70. String pass="";

  71. String coding="";

  72. request.setCharacterEncoding("utf-8");

  73. userid=request.getParameter("userid");

  74. pass=request.getParameter("pass");

  75. if(Login_Process(userid,pass,coding))

  76. out.print("登录成功!");

  77. else

  78. out.print("登录失败!");


  79. %>

  80. <%=userid %>,<%=pass %>

  81. </body>

  82. </html>


0

上一篇:没有了

:下一篇

精彩评论

暂无评论...
验证码 换一张
取 消