zoukankan      html  css  js  c++  java
  • jQueryValidate实现重复性验证

    $(function(){
         $("#frm").validateForm({
              rules:{
                   'caResourceStandard.resourceName':{
                        required:true,
                        remote:{
                             type:"post",
                             url:"/concealedacceptance/caResourceStandard!duplicateCheck.action",
                             data:{
                                  "caPreDataStandard.id":function(){return $("#id").val();},
                             },
                        },
                   },
              },
              messages:{
                   'caResourceStandard.resourceName':{
                        required:"此处不能为空",
                        remote:"该资料名称已存在!"
                   }
              }
         });
    })

    public void duplicateCheck(){
            Integer count = null;
            Map<String,String> map = new HashMap<String, String>();
            map.put("id", caResourceStandard.getId());
            map.put("resourceName", caResourceStandard.getResourceName());
            count = caResourceStandardService.countResourceName(map);
            try {
                response.getWriter().print(count>0?false:true);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    <select id="countResourceName" parameterType="java.util.Map" resultType="Integer">
         SELECT COUNT(1) FROM CA_RESOURCE_STANDARD WHERE RESOURCE_NAME = #{resourceName} AND Z_STATUS = 1<if test="id != null and id != ''">AND ID !=#{id}</if>
    </select>
  • 相关阅读:
    Python-Image 基本的图像处理操作
    剪枝
    poj1182(食物链)续
    HLG2035广搜
    HLG2040二叉树遍历已知前中,求后
    先序,中序,后序,已知两者求第三者
    C++中new的解说
    僵尸进程
    HLG2062(make,heap问题)
    make_head,,,pop_head,,,push_head,,,sort_head..
  • 原文地址:https://www.cnblogs.com/lxcmyf/p/6184212.html
Copyright © 2011-2022 走看看