如何在struts框架下使用ajax验证用户名密码
来源:互联网 发布:虚拟机如何安装ubuntu 编辑:程序博客网 时间:2024/04/28 23:55
1、下载一个ajax框架包prototype.js
2、在jsp页面写
function valid() {
if(document.forms[0].loginid.value!=document.forms[0].orginLoginid.value){
document.getElementById('echo1').innerHTML = "正在检测登录ID...";
var ajax = new Ajax.Request('/bankInfoAction.do', {method: 'get',parameters:'mode=equalLoginId&loginid=' + document.forms [0].loginid.value,onComplete:callback2});
}
else{
document.getElementById('echo1').innerHTML = "";
}
}
function callback2(originalRequest) {
if (originalRequest)
if (originalRequest.readyState == 4) {
if (originalRequest.status == 200) {
if (originalRequest.responseText == "1") {
$('echo1').innerHTML = "该登录ID可以使用!";
} else {
$('echo1').innerHTML = "<font color=red>该登录ID已存在或不可用!</font>";
var logid=document.forms[0].loginid.value;
document.forms[0].loginid.value = "";
document.forms[0].password.value = "";
document.forms[0].password1.value = "";
if(logid!=""){
document.forms[0].loginid.focus();
}
}
}
}
}
3、在action的execute方法里调用。返回的是xml值,如这里的1,0.前台通过0,1判断是否存在ID
if (bankInfoForm.getFlag() == -9) {//这里是判断是否存在,可在command方法里写
write(response, "0", "text/xml", "UTF-8");
} else {
write(response, "1", "text/xml", "UTF-8"); //
}
- 如何在struts框架下使用ajax验证用户名密码
- struts使用Ajax验证用户名是否可用
- 【原创】Openvpn 在windows下使用用户名/密码验证方式
- Ajax验证用户名和密码
- 在其他框架下如何用ajax来验证用户名是否重复
- struts action使用ajax验证用户名是否有被注册
- 使用AJAX的Struts验证框架
- 使用AJAX的Struts验证框架
- 使用AJAX的Struts验证框架
- LINUX下 如何验证系统用户名和密码是否正确。
- 用ajax+struts实现用户名验证功能
- Ajax java struts 实现用户名验证
- Struts+ajax验证用户名是否存在
- ajax +Struts 验证用户名是否注册(异步)
- ajax,struts,jsp验证用户名是否存在
- struts+ajax验证注册用户名是否存在
- ajax+struts实现验证用户名是否存在
- 结合struts使用AJAX验证密码是否正确(一)
- 2008年 ODF 继续赢得政府支持
- Google Hacking for Penetration Testers, Volume 2
- Grid Computing for Bioinformatics and Computational Biology
- 循环变量的使用
- Taking Your iPod Touch to the Max (Technology in Action)
- 如何在struts框架下使用ajax验证用户名密码
- Model-Based Software and Data Integration: First International Workshop, MBSDI 2008, Berlin, Germany
- 无题吧
- Cocoa(R) Programming for Mac(R) OS X
- Designing and Engineering Time: The Psychology of Time Perception in Software
- Implementing SOA : Total Architecture in Practice
- Creating Mac Widgets with Dashcode
- Pro Web 2.0 Application Development with GWT
- Security and Quality of Service in Ad Hoc Wireless Networks