//为了动态生成表格获取数据用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");
}