ajax在jquery中请求和servlet中响应的示例分析
这篇文章主要介绍ajax在jquery中请求和servlet中响应的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

网站建设哪家好,找创新互联建站!专注于网页设计、网站建设、微信开发、小程序设计、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了源汇免费建站欢迎大家使用!
在jsp中,首先,你需要导入jquery的架包:
获取可返回站点的根路径:
<% String path = request.getContextPath(); %>
在jquery中写ajax请求:
jsp部分:
序号 业主名 金额
在servlet中用到了阿里巴巴的快速转换json的包com.alibaba.fastjson.JSON:
private void queryEvaluateByuserId(HttpServletRequest request, HttpServletResponse response) throws SQLException, IOException, ServletException{
HttpSession session=request.getSession();
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
Cookie[] cookies = request.getCookies();
int ownerId = 0;
for (int i = 0; i < cookies.length; i++) {
Cookie cookie = cookies[i];
if (cookie.getName().equals("ownerId")) {
ownerId = Integer.parseInt(cookie.getValue());
}
}
List orderList = new ArrayList<>();
List queryEvaluateList = new ArrayList<>();
orderList = orderServiceImpl.queryOrderList(ownerId, null, null, null, null, null);
List 以上是“ajax在jquery中请求和servlet中响应的示例分析”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!
分享题目:ajax在jquery中请求和servlet中响应的示例分析
网站地址:http://lzwzjz.cn/article/jposgo.html


咨询
建站咨询
