您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > Java调用WebService接口实现发送手机短信验证码功能
近来由于项目需要,需要用到手机短信验证码的功能,其中最主要的是用到了第三方提供的短信平台接口WebService客户端接口,下面我把我在项目中用到的记录一下,以便给大家提供个思路,由于本人的文采有限,还请大家见谅!一:首先上几张案例截图,以便大家可以了解一下短信验证码的流程,这里我在做的过程中也参考了很多网站的短信验证码,比如:58同城,汽车之家等。1.点击获取验证码之前的样式:2.输入正确的手机号后点击获取验证码之后的样式:3.如果手机号已经被注册的样式:4.如果一个手机号一天发送超过3次就提示不能发送:二:前台的注册页面的代码:reg.jsp%@pagelanguage=javaimport=java.util.*pageEncoding=UTF-8%%@taglibprefix=suri=/struts-tags%%@pageimport=cn.gov.csrc.base.action.FindAllData%%Stringpath=request.getContextPath();StringbasePath=request.getScheme()+://+request.getServerName()+:+request.getServerPort()+path+/;%!DOCTYPEHTMLPUBLIC-//W3C//DTDHTML4.01Transitional//ENhtmlheadbasehref=%=basePath%title中国证券会证券期货违法违规举报中心-注册/titlemetahttp-equiv=pragmacontent=no-cachemetahttp-equiv=cache-controlcontent=no-cachemetahttp-equiv=expirescontent=0metahttp-equiv=keywordscontent=keyword1,keyword2,keyword3metahttp-equiv=descriptioncontent=Thisismypagelinkrel=shortcuticontype=image/x-iconhref=%=request.getContextPath()%/images/favicon.ico/linkrel=stylesheettype=text/csshref=%=request.getContextPath()%/css/main.csslinkhref=%=request.getContextPath()%/formValidator1/style/validator.cssrel=stylesheettype=text/css/styletype=text/cssbutton{background:#F0F0F0repeat-x;padding-top:3px;border-top:1pxsolid#708090;border-right:1pxsolid#708090;border-bottom:1pxsolid#708090;border-left:1pxsolid#708090;width:auto;line-height:12pt;font-size:10pt;cursor:hand;font-size:10pt;border-top:1pxsolid#708090;}/stylescriptsrc=%=request.getContextPath()%/js/jquery-1.7.2.min.jstype=text/javascript/scriptscriptsrc=%=request.getContextPath()%/formValidator1/formValidator-4.0.1.jstype=text/javascript/scriptscriptsrc=%=request.getContextPath()%/formValidator1/formValidatorRegex.jstype=text/javascript/scriptscriptsrc=%=request.getContextPath()%/js/register.jstype=text/javascript/scriptscriptsrc=%=request.getContextPath()%/js/sms.jstype=text/javascript/scriptscripttype=text/javascriptfunctionchangeCheckNum(){varcheckNumImage_=document.getElementById(checkNumImage);checkNumImage_.src=${pageContext.request.contextPath}/image.jsp?timeStamp=+newDate().getTime();}/scriptscripttype=text/javascriptvarmsg=${message};if(msg!=){alert(msg);}/script/headbody%@includefile=/statics/top.jspf%divclass=center_divisiondivclass=center_bodydivclass=center_menufontcolor=#000000当前位置:/fontahref=%=request.getContextPath()%/statics/reg.jspfontcolor=#000000用户注册/font/a/div/divdivclass=center_body_menus:formaction=RegisterAction_registerid=form1name=form1method=postnamespace=/tableid=tbtrtdcolspan=3align=centerbgcolor=#DDDFE1举报人基本信息/td/trtrtdalign=centerwidth=30%imgsrc=images/new_reg_xing.gif/用户名:/tdtdalign=centerwidth=40%s:textfieldname=usernameid=usernamecssStyle=width:160px;height:24px;onblur=checkusername()//tdtdalign=leftwidth=30%spanid=usernameTips:fielderrorcssStyle=color:red;padding-left:10px;s:paramusername/s:param/s:fielderror/span/td/trtrtdalign=centerwidth=30%imgsrc=images/new_reg_xing.gif/登录密码:/tdtdalign=centerwidth=40%s:passwordname=passwordid=passwordcssStyle=width:160px;height:24px;onblur=checkpassword()//tdtdalign=leftwidth=30%spanid=passwordTips:fielderrorcssStyle=color:red;padding-left:10px;s:parampassword/s:param/s:fielderror/span/td/trtrtdalign=centerwidth=30%imgsrc=images/new_reg_xing.gif/确认密码:/tdtdalign=centerwidth=40%s:passwordname=passwordRepeatid=passwordRepeatcssStyle=width:160px;height:24px;onblur=checkpasswrodb()//tdtdalign=leftwidth=30%spanid=passwordRepeatTips:fielderrorcssStyle=color:red;padding-left:10px;s:parampasswordRepeat/s:param/s:fielderror/span/td/trtrtdalign=centerwidth=30%imgsrc=images/new_reg_xing.gif/姓名:/tdtdalign=centerwidth=40%s:textfieldname=nicknameid=nicknamecssStyle=width:160px;height:24px;onblur=checknickname()//tdtdalign=leftwidth=30%spanid=nicknameTips:fielderrorcssStyle=color:red;padding-left:10px;s:paramnickname/s:param/s:fielderror/span/td/trtrtdalign=centerwidth=30%性别:/tdtdalign=centerwidth=40%s:radiolist=#application.dataMap.get('10001')name=jbSexcssStyle=height:24px;//tdtdalign=leftwidth=30%/td/trtrtdalign=centerwidth=30%联系地址:/tdtdalign=centerwidth=40%s:textfieldname=jbAddressid=jbAddresscssStyle=width:160px;height:24px;//tdtdalign=leftwidth=30%spanid=jbAddressTips:fielderrorcssStyle=color:red;padding-left:10px;s:paramjbAddress/s:param/s:fielderror/span/td/trtrtdalign=centerwidth=30%imgsrc=images/new_reg_xing.gif/联系手机:/tdtdalign=centerwidth=40%s:textfieldid=jbPhonename=jbPhonecssStyle=width:160px;height:24px;onblur=checkjbPhone()//tdtdalign=leftwidth=30%spanid=jbPhoneTips:fielderrorcssStyle=color:red;padding-left:10px;s:paramjbPhone/s:param/s:fielderror/span/td/trtrtdalign=centerimgsrc=images/new_reg_xing.gif/短信验证码:/tdtdalign=leftcolspan=2style=padding-left:1
本文标题:Java调用WebService接口实现发送手机短信验证码功能
链接地址:https://www.777doc.com/doc-2881587 .html