首页 > 编程知识 正文

用户登录界面图片,登录界面怎么做

时间:2023-05-06 20:16:20 阅读:141430 作者:2036

1 )设计用户登录页面、用户登录信息验证页面、用户登录成功页面、错误处理页面、两个受保护页面、静态包含的若干页面片段。

2 )用户登录信息包括学号和密码,学号是本人的学号,如果密码正确,登录成功,自动跳转至用户登录成功页面。 如果出现异常(如未输入学校编号、未输入密码、学校编号或密码不正确),请抛出异常并在错误处理页中处理。

3 )显示成功登录页面、已登录用户信息和受保护页面访问权限的列表。

4 )在受保护的网页上介绍本人简历在受保护的网页上介绍本人的兴趣爱好。 这两个页面必须登录后才能访问。 如果您没有登录,请跳至登录页面。

5 )有三个静态包含的页面片段。 一个是统一的头信息。 一个是统一的尾部信息。一个是验证用户是否登录的代码。

Login.jsp

1 % @ page language=' Java ' content type=' text/html; charset=utf-8 '2pageencoding=' utf-8 ' % 3! doctype html public '-//W3C//dtd html 4.01 transitional//en ' ' http://www.w3.org/tr/html4/loose.dtd '4html 5 11 ) 12 # main {文本对齐:中心; font-size:18px; padding: 100px; background-color:#FFDAB9; width: 300px; 边距: 3px自动; border :1 px solid } 13/style 14/head 15 body 16 divid=' main ' 17 formaction=' do _ log in.JSP ' method=' post ' 18学号nbsp; nbsp; nbsp; nbsp; 22 input type='submit' value='复位'/form 23/div 24/body 25/html do _ log in.JSP 3360注册裁决

1 % @ page language=' Java ' content type=' text/html; charset=utf-8 '2page encoding=' utf-8 ' %3% @ page error page=' error.JSP ' % 4! doctype html public '-//W3C//dtd html 4.01 transitional//en ' ' http://www.w3.org/tr/html4/loose.dtd '5html 6 12 ) 13/style 14/head 15 body 16 string name=(string ) request.getparameter ) ' username ); 18stringpwd=(string ) request.getparameter('password ); 19if(name==' ' ) (20 throw new Exception ) )请务必填写学校号码!' ); 21elseif(pwd==' ' ) 22 throw new Exception '请务必输入密码!' ); 23 else if (! name.equals(143401010107 ) |! PWD.equals(143401010107 ) ) )

throw new Exception("学号或密码输入错误!"); 25 else if(name!=null && pwd!=null){26 if(name.equals("143401010107")&&pwd.equals("143401010107")){27 session.setAttribute("u", name);28 session.setAttribute("flag", pwd);29 response.sendRedirect("showInfo.jsp");30 }31 }32 %>33 </body>34 </html>

showInfo.jsp:显示登录信息

1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 7 <title>个人信息</title> 8 <style> 9 body{10 background-color:#FFDAB9;11 }12 </style>13 </head>14 <body>15 <%16 String flag = (String)session.getAttribute("flag");17 if(flag!=null){18 response.sendRedirect("select.jsp");19 }else{20 out.print("您还没有登录");21 response.sendRedirect("login.jsp");22 }23 %>24 </body>25 </html>

select.jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>选择</title><style>body{background-color:#FFDAB9;}#main{text-align:center;}</style></head><body id="main"><h1>恭喜你,登录成功!</h1><p>个人信息:</p><br><p>姓名:***</p><br><p>班级:***</p><br><p>学号:***</p><br><a rel="external nofollow" href="resume.jsp"><font size="5">个人简历</font></a><br><br><a rel="external nofollow" href="hobbit.jsp"><font size="5">个人爱好</font></a></body></html>

resume.jsp:

1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7 <title>个人简历</title> 8 <style> 9 #top{text-align:center;font-size:12px;}10 #main{text-align:center;font-size:18px;}11 #bottom{text-align:center;font-size:12px;}12 body{13 background-color:#FFDAB9;14 }15 </style>16 </head>17 <body>18 <div id="top"><%@include file="top.jsp" %></div>19 <div id="main">20 <h1>本人简历</h1>21 <p>姓名:***</p>22 <p>性别:女</p>23 <p>籍贯:****</p>24 <p>联系方式:*********</p>25 <p>......</p>26 </div>27 <div id="bottom"><%@include file="bottom.jsp" %></div>28 </body>29 </html>

hobbit.jsp:

1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7 <title>个人爱好</title> 8 <style> 9 #top{text-align:center;font-size:12px;}10 #main{text-align:center;font-size:18px;}11 #bottom{text-align:center;font-size:12px;}12 body{13 background-color:#FFDAB9;14 }15 </style>16 </head>17 <body>18 <div id="top"><%@include file="top.jsp" %></div>19 <div id="main">20 <h1>本人爱好</h1>21 <p>喜欢跑步</p>22 <p>喜欢听情歌</p>23 <p>喜欢吃零食</p>24 <p>喜欢看电影</p>25 <p>喜欢睡大觉</p>26 <p>......</p>27 </div>28 <div id="bottom"><%@include file="bottom.jsp" %></div>29 </body>30 </html>

top.jsp:

1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7 <title>头部内容</title> 8 </head> 9 <body>10 <p><font size="2" color="blue">This page is made by 143401010107</font></p>11 <hr>12 </body>13 </html>

bottom.jsp:

1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7 <title>尾部内容</title> 8 </head> 9 <body>10 <hr>11 <p>12 <font size="2" color="red">CopyRight@copy2017.<br>有任何问题请联系<a rel="external nofollow" href="mail:****@qq.com">**</a>13 </font></p>14 </body>15 </html>

 

转载于:https://www.cnblogs.com/Lia-633/p/7802640.html

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。