-
简介:【导读】本文介绍如何利用AJAX实现与服务器通信的功能,并给出代码及其比较。首先看下看下相对简单些的——向服务器发送一个包含有名/值对的简单查询串,在这种情况下XHP即可以用GET也可以用POST。 GETfunction doRequestUsingGET() { createXMLHttpRequest(); var queryString = GetAndPostExample…


AJAX实践之与服务器通信
String birthday = request.getParameter( " birthday " );
// Create the response text
String responseText = " Hello " + firstName + " " + middleName
+ " . Your birthday is " + birthday + " . "
+ " [Method: " + method + " ] " ;
// Write the response back to the browser
PrintWriter out = response.getWriter();
out.println(responseText);
// Close the writer
out.close();
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
// Process the request in method processRequest
processRequest(request, response, " GET " );
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
// Process the request in method processRequest
p
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>
网友评论:
发表您对AJAX实践之与服务器通信的评论
·用户发表意见仅代表其个人意见,并且承担一切因发表内容引起的纠纷和责任
·本站管理人员有权在不通知用户的情况下删除不符合规定的评论信息或留做证据
·请客观的评价您所看到的教程,提倡就事论事,杜绝漫骂和人身攻击等不文明行为
·本站管理人员有权在不通知用户的情况下删除不符合规定的评论信息或留做证据
·请客观的评价您所看到的教程,提倡就事论事,杜绝漫骂和人身攻击等不文明行为
最新教程


推荐教程


- 此栏目下没有推荐教程

