通过表单向服务端发起请求
通过链接向服务端发起请求
Ajax向服务端发起请求
pageEncoding="UTF-8"%>
String path = request.getContextPath();
String basepath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ path + "/";
out.println(basepath); // http://localhost:8080/BaseServlet/
%>
index pagefunction fun() {
$.get("/StuServlet", {
"method" : "selectStu",
"user" : "tom"
}, function(data) {
alert(data);
});
}
form表单post提交
Ajax方式