这次给大家带来在jquery的请求ajax与在servlet中的响应ajax,在jquery的请求ajax与在servlet中的响应ajax的注意事项有哪些,下面就是实战案例,一起来看一下。
在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 相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
推荐阅读:
PHPShop开源购物程序是PHPSHOP专业购物开发团队自主开发完全按照 WEB2.0 标准架构的一 套完整、专业的购物系统,主要面向企业和大中型网商提供最佳保障,最大化满足客户目前 及今后的独立网店应用需求。完善的使用功能足以满足专业购物网站的需求,在用户体验方 面使用了ajax技术,让您的网站耳目一新。其非凡的负载能力,强大的功能,良好的管理界面 一直以来都受到广大用户的称赞。 该系统运行于









