可以就是在浏览器里创建员工信息 并查看出来吗 ???(不需要表单结构)
可以就是在浏览器里创建员工信息 并查看出来吗 ???(不需要表单结构)
可以就是在浏览器里创建员工信息 并查看出来吗 ???(不需要表单结构)
2016-12-10
可以啊!用ajax异步,直接在js里面:
<script type="text/javascript">
document.getElementById("ll").onblur = function () {
var request;
if (window.XMLHttpRequest) { //如果支持ajax
request = new XMLHttpRequest();
} else {
request = new ActiveXObject("Microsoft.XMLHTTP");
}
request.open("post", "jie", true); //向服务器发送请求
request.setRequestHeader("content-type","application/x-www-form-urlencoded");
request.send("name="+document.getElementById("ll").value+"");
request.onreadystatechange=function(){
if(request.readyState==4&&request.status==200){ //请求成功和响应成功
alert(request.responseText); //得到数据
}
}
}
</script>
jsp代码:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter out=response.getWriter();
out.print("你好");
out.flush();
out.close();
}
举报