av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

使用JSP實(shí)現(xiàn)簡(jiǎn)單的用戶登錄注冊(cè)頁(yè)面示例代碼解析

瀏覽:239日期:2022-06-08 09:41:05

實(shí)驗(yàn)要求:

將實(shí)驗(yàn)2中的系統(tǒng)用戶登錄和注冊(cè)頁(yè)面改為JSP頁(yè)面,并部署自己的Web應(yīng)用于Tomcat服務(wù)器中

具體要求:

完成登錄JSP頁(yè)面設(shè)計(jì)和注冊(cè)頁(yè)面設(shè)計(jì)

在登錄頁(yè)面表單中使用request對(duì)象獲取用戶信息,建立新的JSP頁(yè)面完成登錄驗(yàn)證(用戶名和密碼自己指定即可)。

驗(yàn)證結(jié)果顯示(如登錄成功/用戶名密碼錯(cuò)誤,可以使用JavaScript,也可以使用新的JSP頁(yè)面)。

在注冊(cè)頁(yè)面表單中使用request對(duì)象獲取用戶注冊(cè)信息(注冊(cè)項(xiàng)目由自己指定),在新的JSP頁(yè)面顯示用戶注冊(cè)信息,并提示注冊(cè)成功。

代碼

登錄頁(yè)面index.html

<!DOCTYPE html><html lang="zh-CN"><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>jsp作業(yè)</title> <link href="css/bootstrap.min.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="stylesheet"></head><body><nav> <div>  <div>   <a href="./" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >jsp作業(yè)</a>  </div>  <div id="bs-example-navbar-collapse-1">   <ul>    <li><a href="login.jsp" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >登錄</a></li>   </ul>  </div> </div></nav><div> <div>  <h1>Hello, world!</h1>  <p>這是一個(gè)jsp作業(yè)</p> </div></div></body></html>

登錄頁(yè)面login.jsp

<%@ page contentType="text/html; charset=utf-8" language="java"%><html lang="zh-CN"><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>登錄</title> <link href="css/bootstrap.min.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="stylesheet"></head><body><nav> <div>  <div>   <a href="./" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >jsp作業(yè)</a>  </div>  <div id="bs-example-navbar-collapse-1">   <ul>    <li><a href="login.jsp" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >登錄</a></li>   </ul>  </div> </div></nav><div> <div>  <div>  </div>  <div>   <form method="post" action="login-check.jsp">    <h2>登錄到j(luò)sp作業(yè)</h2>    <label for="">用戶名</label>    <input type="text" name="username" id="username" placeholder="請(qǐng)輸入用戶名" required autofocus><br>    <label for="">密碼</label>    <input type="password" name="password" id="password" placeholder="請(qǐng)輸入密碼" required>    <div>     <label>      <input type="checkbox" value="remember-me" checked="checked"> 記住密碼     </label>    </div>    <button type="submit" id="btn-login">登錄</button>    <a href="reg.jsp" rel="external nofollow" rel="external nofollow">注冊(cè)</a>   </form>  </div>  <div>  </div> </div></body></html>

登錄結(jié)果頁(yè)面login-check.jsp

<%@ page contentType="text/html; charset=utf-8" language="java"%><html lang="zh-CN"><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>登錄</title> <link href="css/bootstrap.min.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="stylesheet"></head><body><nav> <div>  <div>   <a href="./" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >jsp作業(yè)</a>  </div>  <div id="bs-example-navbar-collapse-1">   <ul>    <li><a href="login.jsp" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >登錄</a></li>   </ul>  </div> </div></nav><div> <div>  <div>  </div>  <div>   <form method="post" action="login-check.jsp">    <h2>登錄到j(luò)sp作業(yè)</h2>    <label for="">用戶名</label>    <input type="text" name="username" id="username" placeholder="請(qǐng)輸入用戶名" required autofocus><br>    <label for="">密碼</label>    <input type="password" name="password" id="password" placeholder="請(qǐng)輸入密碼" required>    <div>     <label>      <input type="checkbox" value="remember-me" checked="checked"> 記住密碼     </label>    </div>    <button type="submit" id="btn-login">登錄</button>    <a href="reg.jsp" rel="external nofollow" rel="external nofollow">注冊(cè)</a>   </form>  </div>  <div>  </div> </div></body></html>

注冊(cè)頁(yè)面reg.jsp

<%@ page contentType="text/html; charset=utf-8" language="java"%><html lang="zh-CN"><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>注冊(cè)</title> <link href="css/bootstrap.min.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="stylesheet"></head><body><nav> <div>  <div>   <a href="./" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >jsp作業(yè)</a>  </div>  <div id="bs-example-navbar-collapse-1">   <ul>    <li><a href="login.jsp" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >登錄</a></li>   </ul>  </div> </div></nav><div> <div>  <div>  </div>  <div>   <form action="reg-submit.jsp" method="post">    <h2>注冊(cè)到j(luò)sp作業(yè)</h2>    <div id="info">    </div>    <label for="">用戶名</label>    <input type="text" name="username" id="username" placeholder="請(qǐng)輸入用戶名" required autofocus><br>    <label for="">密碼</label>    <input type="password" name="password" id="password" placeholder="請(qǐng)輸入密碼" required><br>    <label for="">重復(fù)密碼</label>    <input type="password" name="password2" id="password2" placeholder="請(qǐng)?jiān)俅屋斎朊艽a" required maxLength="16"><br>    <button type="submit" id="btn-reg">注冊(cè)</button>    <a href="login.jsp" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" id="btn-reg">返回登錄</a>   </form>  </div>  <div>  </div> </div></body></html>

注冊(cè)結(jié)果頁(yè)面reg-submit.jsp

<%@ page contentType="text/html; charset=utf-8" language="java"%><html lang="zh-CN"><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>結(jié)果</title> <link href="css/bootstrap.min.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="stylesheet"></head><body><nav> <div>  <div>   <a href="./" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >jsp作業(yè)</a>  </div>  <div id="bs-example-navbar-collapse-1">   <ul>    <li><a href="login.jsp" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >登錄</a></li>   </ul>  </div> </div></nav><div> <% String username = request.getParameter("username"); String password = request.getParameter("password");  String password2 = request.getParameter("password2");  %> <% if(password.equals(password2)){  out.println("<div class="alert alert-success" role="alert">注冊(cè)成功</div>");  out.println("<ul class="list-group">");  out.println("<li class="list-group-item">用戶名:" + username + "</li>");  out.println("<li class="list-group-item">密碼:" + password + "</li>");  out.println("</ul>"); } else{  out.println("<div class="alert alert-danger" role="alert">兩次密碼輸入不一致,請(qǐng)重新輸入</div>"); } %> <!-- <%=username %> <%=password %> <%=password2 %> --></div>

效果





到此這篇關(guān)于使用JSP實(shí)現(xiàn)簡(jiǎn)單的用戶登錄注冊(cè)頁(yè)面示例代碼解析的文章就介紹到這了,更多相關(guān)JSP實(shí)現(xiàn)簡(jiǎn)單的用戶登錄注冊(cè)頁(yè)面內(nèi)容請(qǐng)搜索以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持!

標(biāo)簽: JSP
主站蜘蛛池模板: 在线观看网址你懂的 | 91精品久久久久久久久久 | 黄色一级免费看 | 一级毛片在线 | 欧美一级片免费 | 欧美亚洲在线观看 | 亚洲精品在线视频 | 少妇一级片 | 午夜在线免费视频 | 日本xxxx69| 日韩av在线免费看 | 久久天堂网 | 欧美日韩免费一区二区三区 | 国产网站在线 | 成人av在线网站 | 日韩一级片 | 免费人成 | 日韩av一区二区在线观看 | 亚洲精品视频在线播放 | 精品一区二区三区在线观看 | 丁香六月激情 | 日本欧美在线观看 | 黄色xxxxx | 国产日韩精品在线 | 日韩一区精品 | 欧美黄色精品 | 五月婷视频 | 久久精品在线播放 | 婷婷av在线 | 人人插人人爱 | 免费在线观看黄 | 日韩一区三区 | 在线观看视频国产 | 国产91免费 | 91靠逼视频| 韩国理论在线 | 国产精品成人一区二区三区 | 中文字字幕在线 | 秋霞午夜鲁丝一区二区老狼 | 日韩精品国产精品 | 国产黄色精品视频 |