axaj 的回调

//为了动态生成表格获取数据用ajax获取servlet回调数据

<script>

$.ajax({

url = "servlet地址",

type : "post",

success:function(data){

alert(data);

}

})

 

</script>

servlet的写法

String eno = request.getParameter("empno");
String ename = request.getParameter("empname");

EmpDAO empDAO = new EmpDAO();
Emp emp = empDAO.login(eno, ename);

PrintWriter out = response.getWriter();

if(emp!=null){
out.print("ok");
}else{
out.println("error");
}

posted on 2018-06-21 10:30  JETIME庚  阅读(95)  评论(0编辑  收藏  举报

导航