java异步判断数据库是否有重复字段值

  action:

  public String findusergroupyname(){

  集合 = 方法(字段值);

  if(this.usergrouplst!=null&&this.usergrouplst.size()>0){

  try {

  PrintWriter pw = ServletActionContext.getResponse().getWriter();

  pw.write("1");

  pw.close();

  } catch (IOException e) {

  // TODO Auto-generated catch block

  e.printStackTrace();

  }

  }

  return null;

  }

  jsp页面:

  <script type="text/javascript">

  function findname(){

  var ff = "<%=basePath%>";

  var url = ff+"方法";

  var 穿的值=$("#标签id").val();

  if(穿的值!=''&& 穿的值!=null){

  $.ajax({

  url: url,

  type: "POST",

  data: "穿的值="+穿的值,

  success: function(result1){

  if(result1 =="1"){

  alert("对不起,此店员号已经存在");

  document.getElementById("标签id").value="";

  document.getElementById("标签id").focus();

  }else if(穿的值==""){

  alert("对不起,店员名填写sducc1122");http://aletaigouwu.com

  document.getElementById("标签id").focus();

  }

  }

  });

  }else{

  alert("对不起,此店员名不能为空 ");

  document.getElementById("clerkName").focus();

  }

  }

  </script

  <input type="text" name="" id=" " οnblur="findname()" >

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值