需要首先下载jquery.metadata.js和jquery.validate.js
@RequestMapping("/hasexists") public @ResponseBody String hasexists(@RequestParam String type) { Rule rule = ruleDao.findUniq("type", type); if(rule!=null) { return "false"; } else { return "true"; } }?
<p> <label>类型:</label> <input id="type" name="type" class="required {remote:'payment/rule/hasexists',messages:{remote:'该类型已被使用'}}" type="text" size="20" /> </p>
?
显示结果:
?