sso接口的調用

之前一直想sso接口已經寫好了,登錄注冊功能是怎么調用的呢?原來在登錄注冊的jsp頁面實現的接口的調用,頁面的校驗和驗證功能在jsp頁面即可實現。

?

注冊頁面:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache,must-revalidate"><title>注冊-個人用戶</title><link type="text/css" rel="stylesheet" href="/css/regist.personal.css"/><link type="text/css" rel="stylesheet" href="/css/passport.base.css"/><script type="text/javascript" src="/js/jquery-1.6.4.js"></script>
</head>
<body>
<div class="w" id="logo"><div><a href="http://localhost:8082"><img src="/images/taotao-logo.gif" alt="淘淘商城" width="170" height="60"/></a> <b></b></div>
</div><div class="w" id="regist"><div class="mt"><ul class="tab"><li class="curr">個人用戶</li></ul><div class="extra"><span>我已經注冊,現在就?<a href="/page/login" class="flk13">登錄</a></span></div></div><div class="mc"><form id="personRegForm" method="post" οnsubmit="return false;"><div class="form" onselectstart="return false;"><div class="item" id="select-regName"><span class="label"><b class="ftx04">*</b>用戶名:</span><div class="fl item-ifo"><div class="o-intelligent-regName"><input type="text" id="regName" name="username" class="text" tabindex="1" autoComplete="off"οnpaste="return false;"value=""οnfοcus="if(this.value=='') this.value='';this.style.color='#333'"οnblur="if(this.value=='') {this.value='';this.style.color='#999999'}"/><i class="i-name"></i><ul id="intelligent-regName" class="hide"></ul><label id="regName_succeed" class="blank"></label><label id="regName_error" class="hide"></label></div></div></div><div id="o-password"><div class="item"><span class="label"><b class="ftx04">*</b>請設置密碼:</span><div class="fl item-ifo"><input type="password" id="pwd" name="password" class="text" tabindex="2"style="ime-mode:disabled;"οnpaste="return  false" autocomplete="off"/><i class="i-pass"></i><label id="pwd_succeed" class="blank"></label><label id="pwd_error"></label><span class="clr"></span></div></div><div class="item"><span class="label"><b class="ftx04">*</b>請確認密碼:</span><div class="fl item-ifo"><input type="password" id="pwdRepeat" name="pwdRepeat" class="text" tabindex="3"οnpaste="return  false" autocomplete="off"/><i class="i-pass"></i><label id="pwdRepeat_succeed" class="blank"></label><label id="pwdRepeat_error"></label></div></div><div class="item" id="dphone"><span class="label"><b class="ftx04">*</b>驗證手機:</span><div class="fl item-ifo"><input type="text" id="phone" maxlength="11" name="phone"class="text" tabindex="4"autocomplete="off" /> <i class="i-phone"></i> <labelid="phone_succeed" class="blank"></label> <labelid="phone_error"></label></div></div></div><div class="item item-new"><span class="label">?</span><div class="fl item-ifo"><input type="checkbox" class="checkbox" checked="checked" id="readme"οnclick="agreeonProtocol();"><label for="protocol">我已閱讀并同意<a href="#" class="blue" id="protocol">《淘淘用戶注冊協議》</a></label><span class="clr"></span><label id="protocol_error" class="error hide">請接受服務條款</label></div></div><div class="item"><span class="label">?</span><input type="button" class="btn-img btn-regist" id="registsubmit" value="立即注冊" tabindex="8"clstag="regist|keycount|personalreg|07"οnclick="REGISTER.reg();"/></div></div><div class="phone"><img width="180" height="180" src="/images/phone-bg.jpg"></div><span class="clr"></span></form></div>
<script type="text/javascript">var REGISTER={param:{//單點登錄系統的urlsurl:""},inputcheck:function(){//不能為空檢查if ($("#regName").val() == "") {alert("用戶名不能為空");$("#regName").focus();return false;}if ($("#pwd").val() == "") {alert("密碼不能為空");$("#pwd").focus();return false;}if ($("#phone").val() == "") {alert("手機號不能為空");$("#phone").focus();return false;}//密碼檢查if ($("#pwd").val() != $("#pwdRepeat").val()) {alert("確認密碼和密碼不一致,請重新輸入!");$("#pwdRepeat").select();$("#pwdRepeat").focus();return false;}return true;},beforeSubmit:function() {//檢查用戶是否已經被占用$.ajax({
//這是校驗的接口調用,通過接口中的url來實現的url : REGISTER.param.surl + "/user/check/"+escape($("#regName").val())+"/1?r=" + Math.random(),success : function(data) {if (data.data) {//檢查手機號是否存在$.ajax({url : REGISTER.param.surl + "/user/check/"+$("#phone").val()+"/2?r=" + Math.random(),success : function(data) {if (data.data) {REGISTER.doSubmit();} else {alert("此手機號已經被注冊!");$("#phone").select();}}});} else {alert("此用戶名已經被占用,請選擇其他用戶名");$("#regName").select();} }});},doSubmit:function() {
//這是注冊的接口,通過注冊接口的URL來實現的調用$.post("/user/register",$("#personRegForm").serialize(), function(data){if(data.status == 200){alert('用戶注冊成功,請登錄!');REGISTER.login();} else {alert("注冊失敗!");}});},login:function() {location.href = "/page/login";return false;},reg:function() {if (this.inputcheck()) {this.beforeSubmit();}}}; </script> </body> </html>

 登錄頁面

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"/><title>登錄淘淘</title><link type="text/css" rel="stylesheet" href="/css/login.css"/><script type="text/javascript" src="/js/jquery-1.6.4.js"></script>
</head>
<body>
<div class="w"><div id="logo"><a href="http://localhost:8082" clstag="passport|keycount|login|01"><img src="/images/taotao-logo.gif" alt="淘淘" width="170" height="60"/></a><b></b></div>
</div>
<form id="formlogin" method="post" οnsubmit="return false;"><div class=" w1" id="entry"><div class="mc " id="bgDiv"><div id="entry-bg" clstag="passport|keycount|login|02" style="width: 511px; height: 455px; position: absolute; left: -44px; top: -44px; background: url(/images/544a11d3Na5a3d566.png) 0px 0px no-repeat;"></div><div class="form "><div class="item fore1"><span>用戶名</span><div class="item-ifo"><input type="text" id="loginname" name="username" class="text"  tabindex="1" autocomplete="off"/><div class="i-name ico"></div><label id="loginname_succeed" class="blank invisible"></label><label id="loginname_error" class="hide"><b></b></label></div></div><script type="text/javascript">setTimeout(function () {if (!$("#loginname").val()) {$("#loginname").get(0).focus();}}, 0);</script><div id="capslock"><i></i><s></s>鍵盤大寫鎖定已打開,請注意大小寫</div><div class="item fore2"><span>密碼</span><div class="item-ifo"><input type="password" id="nloginpwd" name="password" class="text" tabindex="2" autocomplete="off"/><div class="i-pass ico"></div><label id="loginpwd_succeed" class="blank invisible"></label><label id="loginpwd_error" class="hide"></label></div></div><div class="item login-btn2013"><input type="button" class="btn-img btn-entry" id="loginsubmit" value="登錄" tabindex="8" clstag="passport|keycount|login|06"/></div></div></div><div class="free-regist"><span><a href="/page/register" clstag="passport|keycount|login|08">免費注冊>></a></span></div></div>
</form>
<script type="text/javascript">var redirectUrl = "${redirect}";var LOGIN = {checkInput:function() {if ($("#loginname").val() == "") {alert("用戶名不能為空");$("#loginname").focus();return false;}if ($("#nloginpwd").val() == "") {alert("密碼不能為空");$("#nloginpwd").focus();return false;}return true;},doLogin:function() {
//這里是一樣的功能,調用登錄的接口來實現的
$.post("/user/login", $("#formlogin").serialize(),function(data){if (data.status == 200) {alert("登錄成功!");if (redirectUrl == "") {location.href = "http://localhost:8082";} else {location.href = redirectUrl;}} else {alert("登錄失敗,原因是:" + data.msg);$("#loginname").select();}});},login:function() {if (this.checkInput()) {this.doLogin();}}};$(function(){$("#loginsubmit").click(function(){LOGIN.login();});}); </script> </body> </html>

  

 

轉載于:https://www.cnblogs.com/fengli9998/p/6403418.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/259588.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/259588.shtml
英文地址,請注明出處:http://en.pswp.cn/news/259588.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

java js獲取css方法_5種JavaScript和CSS交互的方法

原標題&#xff1a;5種JavaScript和CSS交互的方法隨著瀏覽器不斷的升級改進&#xff0c;CSS和Java之間的界限越來越模糊。本來它們是負責著完全不同的功能&#xff0c;但最終&#xff0c;它們都屬于網頁前端技術&#xff0c;它們需要相互密切的合作。我們的網頁中都有.js文件和…

(轉)Http協議經典詳解

轉自&#xff1a;http://blog.csdn.net/gueter/archive/2007/03/08/1524447.aspx Author :Jeffrey 引言 HTTP 是一個屬于應用層的面向對象的協議&#xff0c;由于其簡捷、快速的方式&#xff0c;適用于分布式超媒體信息系統。它于1990…

CentOS 同步時間

來源&#xff1a;http://www.ctusky.com/16/0497/ 用date查看系統當前時間&#xff0c;date -R 可查看時區。 CentOS 同步時間由ntp服務提供&#xff0c;可以用"yum install ntp -y"安裝. 裝完后運行命令 ntpdate cn.pool.ntp.org同步時間&#xff0c;然后hwclock -w…

[逆向][Writeup]ISG2015 flagfinder - .NET程序逆向

這個題目同樣是一道.NET的逆向題&#xff0c;.NET的逆向方法在之前的博文中已經介紹過&#xff0c;這里不做重復的說明。本題的源程序可以在我的github上下載&#xff1a;https://github.com/gsharpsh00ter/reverse 0x01 逆向 flagfinder為.NET編譯的PE文件&#xff0c;用dnSpy…

spring是如何管理 事務的

Spring提供的事務管理可以分為兩類&#xff1a;編程式的和聲明式的。編程式的&#xff0c;比較靈活&#xff0c;但是代碼量大&#xff0c;存在重復的代碼比較多&#xff1b;聲明式的比編程式的更靈活方便。 1、傳統使用JDBC的事務管理 以往使用JDBC進行數據操作&#xff0c;使用…

java 編譯原理 字符串_Java編譯原理(javac)

Java中的編譯分為兩個部分&#xff1a;源碼文件編譯成字節碼文件(前端編譯)字節碼文件被虛擬機加載以后編譯成機器碼(后端編譯)對于開發來說接觸的一般都是第一個步驟也就是源碼編譯成字節碼文件(class文件)&#xff0c;第二個步驟開發幾乎不會接觸&#xff0c;因為這是虛擬機在…

sql2012一段時間無法連接報53錯誤

2019獨角獸企業重金招聘Python工程師標準>>> 解決方案 在sqlserver網絡配置下的msqlserver協議下改將ip3改成如下圖所示 轉載于:https://my.oschina.net/u/2511906/blog/840373

ICE第三篇------一些疑難點

1 間接代理 參考http://blog.sina.com.cn/s/blog_53e8499c0100lkoo.html IceGrid用于支持分布式網絡服務應用&#xff0c;一個IceGrid域由一個注冊表&#xff08;Registry&#xff09;和任何數目的節點(Node)構成。注冊表&#xff08;Registry&#xff09;和節點(Node)一起合作…

windows phone 8 使用頁面傳對象的方式 實現頁面間的多值傳遞

在做windows phone 開發的時候&#xff0c;會經常碰到頁面間之間的跳轉和傳遞數據&#xff0c;如果傳遞的值不多&#xff0c;只有兩三個&#xff0c;我們通常使用NavigationService.Navigate(new Uri("頁面名? Name“”&ID“ ”, UriKind.Relative)); 要是碰到要傳遞…

php生成圖片驗證碼代碼,PHP生成圖片驗證碼以及點擊切換的代碼

這篇文章主要介紹了PHP生成圖片驗證碼實例,同時介紹了點擊切換(看不清&#xff1f;換一張)效果實現方法,需要的朋友可以參考下這里來看下效果:現在讓我們來看下 PHP 代碼<?php session_start();function random($len) {$srcstr "1a2s3d4f5g6hj8k9qwertyupzxcvbnm&quo…

python 時間日期處理

refer to : http://www.wklken.me/posts/2015/03/03/python-base-datetime.html#datetime-string http://www.cnblogs.com/65702708/archive/2011/04/17/2018936.html http://www.runoob.com/python/python-date-time.html 轉載于:https://www.cnblogs.com/qingyuanjushi/p/640…

php 字符型轉變為數值,php怎么把字符串轉換為數值?

php怎么把字符串轉換為數值&#xff1f;下面本篇文章給大家介紹一下PHP把字符串轉換為數值的方法。有一定的參考價值&#xff0c;有需要的朋友可以參考一下&#xff0c;希望對大家有所幫助。PHP中的字符串可以很容易地轉換成數值(float / int / double類型)。在大多數用例中&am…

解決rspec 生成報告時報utf-8錯誤的方法

找到gems\1.9.1\gems\rspec-core-2.14.3\lib\rspec\core\formatters\snippet_extractor.rb文件中的第27行&#xff1a; 在這邊記錄一下&#xff0c;防止以后再遇到。。。出現這個原因是因為ruby文件用utf-8格式的&#xff0c;但是源碼都是GBK處理的&#xff0c;找到\lib\ruby\…

aspose.words復制插入同一word文檔中的某個頁面

選擇word模板 Document doc new Document(Server.MapPath("~\\templet") "\\" name.Name);doc.MailMerge.CleanupOptions doc.MailMerge.CleanupOptions & ~MailMergeCleanupOptions.RemoveUnusedRegions;DocumentBuilder builder new DocumentBu…

開源游戲服務器C#

https://github.com/ScutGame/Scut/wiki轉載于:https://www.cnblogs.com/porter/p/6408955.html

EFProf Entity Framework Profile 工具

SQL Server Profiler用來跟蹤應用程序發送到SQL Server中的SQL語句&#xff0c;用于檢測性能&#xff0c;查找問題。Entity Framework 也有它的跟蹤工具EFProf&#xff0c;用于跟蹤Entity Framework發送到SQL Server中的SQL語句。 首先在代碼中添加對程序集HibernatingRhinos.P…

php面試中的問題,十個值得深思的PHP面試問題

十個值得深思的PHP面試問題過來人在以往的面試中總結的10個值得深思的 PHP 面試問題&#xff0c;希望對你現在的面試有用&#xff0c;少走彎路&#xff0c;更多內容請關注應屆畢業生網!Q1第一個問題關于弱類型$str1 yabadabadoo;$str2 yaba;if (strpos($str1,$str2)) {echo &…

Android中ExpandableListView控件基本使用

本文採用一個Demo來展示Android中ExpandableListView控件的使用&#xff0c;如怎樣在組/子ListView中綁定數據源。直接上代碼例如以下&#xff1a; 程序結構圖&#xff1a; layout文件夾下的 main.xml 文件源代碼例如以下&#xff1a; <?xml version"1.0" encodi…

【暴力】Codeforces Round #398 (Div. 2) A. Snacktower

題意不復述。 用個bool數組記錄一下&#xff0c;如果某一天&#xff0c;當前剩下的最大的出現了的話&#xff0c;就輸出一段。 #include<cstdio> using namespace std; int n; bool vis[100010]; int main() { // freopen("a.in","r",stdin);scanf(&…

javascript的對象創建模式---命名空間模式

javascript中對象的概念是很普遍的&#xff0c;對象是是對象&#xff0c;數組是對象&#xff0c;函數也是對象&#xff0c;字符串其實也是對象。常見的對象創建方法有對象字面量、構造函數創建。我們先來看看對象的創建還有哪些更高級的模式。 一、命名空間模式 二、模塊模式 三…