婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > 使用JSP實現簡單的用戶登錄注冊頁面示例代碼解析

使用JSP實現簡單的用戶登錄注冊頁面示例代碼解析

熱門標簽:電話機器人需要使用網絡嗎 電銷機器人免培訓 自繪地圖標注數據 南通通訊外呼系統產品介紹 如何看懂地圖標注點 外呼系統使用方法 海外圖書館地圖標注點 潤滑油銷售電銷機器人 給地圖標注得傭金

實驗要求:

將實驗2中的系統用戶登錄和注冊頁面改為JSP頁面,并部署自己的Web應用于Tomcat服務器中

具體要求:

完成登錄JSP頁面設計和注冊頁面設計

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

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

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

代碼

登錄頁面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作業/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 class="navbar navbar-default">
 div class="container-fluid">
  div class="navbar-header">
   a class="navbar-brand" href="./" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >jsp作業/a>
  /div>
  div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
   ul class="nav navbar-nav navbar-right">
    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 class="container">
 div class="jumbotron">
  h1>Hello, world!/h1>
  p>這是一個jsp作業/p>
 /div>
/div>
/body>
/html>

登錄頁面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 class="navbar navbar-default">
 div class="container-fluid">
  div class="navbar-header">
   a class="navbar-brand" href="./" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >jsp作業/a>
  /div>
  div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
   ul class="nav navbar-nav navbar-right">
    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 class="container">
 div class="row">
  div class="col-md-4">

  /div>
  div class="col-md-4">
   form class="form-signin" method="post" action="login-check.jsp">
    h2 class="form-signin-heading">登錄到jsp作業/h2>
    label for="">用戶名/label>
    input type="text" name="username" id="username" class="form-control" placeholder="請輸入用戶名" required autofocus>br>
    label for="">密碼/label>
    input type="password" name="password" id="password" class="form-control" placeholder="請輸入密碼" required>
    div class="checkbox">
     label>
      input type="checkbox" value="remember-me" checked="checked"> 記住密碼
     /label>
    /div>
    button type="submit" class="btn btn-primary" id="btn-login">登錄/button>
    a href="reg.jsp" rel="external nofollow" rel="external nofollow" class="btn btn-default">注冊/a>
   /form>
  /div>
  div class="col-md-4">
  /div>
 /div>
/body>
/html>

登錄結果頁面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 class="navbar navbar-default">
 div class="container-fluid">
  div class="navbar-header">
   a class="navbar-brand" href="./" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >jsp作業/a>
  /div>
  div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
   ul class="nav navbar-nav navbar-right">
    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 class="container">
 div class="row">
  div class="col-md-4">

  /div>
  div class="col-md-4">
   form class="form-signin" method="post" action="login-check.jsp">
    h2 class="form-signin-heading">登錄到jsp作業/h2>
    label for="">用戶名/label>
    input type="text" name="username" id="username" class="form-control" placeholder="請輸入用戶名" required autofocus>br>
    label for="">密碼/label>
    input type="password" name="password" id="password" class="form-control" placeholder="請輸入密碼" required>
    div class="checkbox">
     label>
      input type="checkbox" value="remember-me" checked="checked"> 記住密碼
     /label>
    /div>
    button type="submit" class="btn btn-primary" id="btn-login">登錄/button>
    a href="reg.jsp" rel="external nofollow" rel="external nofollow" class="btn btn-default">注冊/a>
   /form>
  /div>
  div class="col-md-4">
  /div>
 /div>
/body>
/html>

注冊頁面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>注冊/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 class="navbar navbar-default">
 div class="container-fluid">
  div class="navbar-header">
   a class="navbar-brand" href="./" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >jsp作業/a>
  /div>
  div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
   ul class="nav navbar-nav navbar-right">
    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 class="container">
 div class="row">
  div class="col-md-4">
  /div>
  div class="col-md-4">

   form class="form-signin" action="reg-submit.jsp" method="post">
    h2 class="form-signin-heading">注冊到jsp作業/h2>
    div id="info">

    /div>
    label for="">用戶名/label>
    input type="text" name="username" id="username" class="form-control" placeholder="請輸入用戶名" required autofocus>br>
    label for="">密碼/label>
    input type="password" name="password" id="password" class="form-control" placeholder="請輸入密碼" required>br>
    label for="">重復密碼/label>
    input type="password" name="password2" id="password2" class="form-control" placeholder="請再次輸入密碼" required maxLength="16">br>
    button type="submit" class="btn btn-primary" id="btn-reg">注冊/button>
    a href="login.jsp" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="btn btn-default" id="btn-reg">返回登錄/a>
   /form>
  /div>
  div class="col-md-4">
  /div>
 /div>
/body>
/html>

注冊結果頁面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>結果/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 class="navbar navbar-default">
 div class="container-fluid">
  div class="navbar-header">
   a class="navbar-brand" href="./" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >jsp作業/a>
  /div>
  div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
   ul class="nav navbar-nav navbar-right">
    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 class="container">
 % 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'>注冊成功/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'>兩次密碼輸入不一致,請重新輸入/div>");
 }
 %>
 !-- %=username %>
 %=password %>
 %=password2 %> -->
/div>

效果





到此這篇關于使用JSP實現簡單的用戶登錄注冊頁面示例代碼解析的文章就介紹到這了,更多相關JSP實現簡單的用戶登錄注冊頁面內容請搜索腳本之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:
  • jsp+dao+bean+servlet(MVC模式)實現簡單用戶登錄和注冊頁面
  • jsp實現用戶自動登錄功能
  • jsp實現簡單用戶7天內免登錄
  • servlet+jsp實現過濾器 防止用戶未登錄訪問
  • JSP Spring防止用戶重復登錄的實現方法
  • JavaWeb實現用戶登錄注冊功能實例代碼(基于Servlet+JSP+JavaBean模式)
  • JSP實現用戶登錄、注冊和退出功能
  • jsp基于XML實現用戶登錄與注冊的實例解析(附源碼)
  • JSP實現簡單的用戶登錄并顯示出用戶信息的方法
  • 在jsp中用bean和servlet聯合實現用戶注冊、登錄
  • 關于JSP用戶登錄連接數據庫詳情

標簽:樂山 南京 黃石 廣州 內江 銅川 貸款邀約 大連

巨人網絡通訊聲明:本文標題《使用JSP實現簡單的用戶登錄注冊頁面示例代碼解析》,本文關鍵詞  使用,JSP,實現,簡單,的,用戶,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《使用JSP實現簡單的用戶登錄注冊頁面示例代碼解析》相關的同類信息!
  • 本頁收集關于使用JSP實現簡單的用戶登錄注冊頁面示例代碼解析的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 石家庄市| 延长县| 浪卡子县| 深州市| 扎赉特旗| 禄劝| 屏东县| 和硕县| 韶山市| 青龙| 黑河市| 高安市| 洛南县| 普兰店市| 玛多县| 石家庄市| 恩施市| 阜宁县| 镇康县| 政和县| 莫力| 全州县| 玉树县| 温州市| 苏尼特左旗| 慈溪市| 海门市| 平江县| 麻栗坡县| 邵武市| 拜城县| 德钦县| 修武县| 高唐县| 麦盖提县| 盱眙县| 德兴市| 沁源县| 信宜市| 贵港市| 海南省|