在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中的响应就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持考高分网。



