校验-js 页面+controller

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加页面</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/index2.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/jquery-3.2.1.js" ></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/jqueryvalidate/jquery.validate.js" ></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/jqueryvalidate/localization/messages_zh.js" ></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/jqueryvalidate/additional-methods.js" ></script>
</head>
<body>
<form action="add" method="post">

<fieldset>
<p>
<label for="name">姓名:</label><input name="name" id="name">
<label for="cardid">身份证号:</label><input name="cardid" id="cardid">
<label for="birthday">生日:</label><input name="birthday" id="birthday">
<label for="schoold">学校:</label><input name="schoold" id="schoold">
<label for="image">图片:</label><input name="image" id="image">
<label for="shengid">省:</label><input name="name" id="name">
<label for="shiid">市:</label><input name="name" id="name">
<label for="xianid">县:</label><input name="name" id="name">

</p>
<p>
<label for="schoold">学校</label>
<select onchange="onSchoolChange()" id="schoold" name="schoold">
<option value="0">---请选择---</option>
<c:forEach items="${schoolList}" var="school">
<option value="${school.id}">${school.name}</option>
</c:forEach>
</select>
<label for="address">地址</label><input disabled="disabled" name="address" id="address">
<label for="tel">电话</label><input disabled="disabled" name="tel" id="tel">
</p>
</fieldset>

</form>
</body>
<script type="text/javascript">

function onSchoolChange(){
var sid = ${"#schoold"}.val();
$.post("./getSchool",{id:sid},function(data){
$("#address").val(data.address);
$("#tel").val(data.tel);
})
}

</script>
</html>

 

 

-----------------------------

 

package com.lzl.controller;

import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lzl.service.UserService;

@Controller
public class UserController {

@Reference
UserService service;

@RequestMapping("validate")
public String myvalidate() {

return "myvalidate";

}

@RequestMapping("checkExist")
@ResponseBody
public boolean checkExist(String username) {
return !"zhangsan".equals(username);
}

}

校验-js 页面+controller

上一篇:oracle 11g r2 添加oratop轻量级监控


下一篇:SQL DEFAULT 约束 auto_increment