jsp页面ajax用法,在jsp中使用jquery的ajax

jQuery.ajax({

url: 'getAssessmentStaffEvaluation.html',

type: 'post',

data: 'userId=' + userid + '&startDate=' + startDate + '&endDate=' + endDate,

dataType:'json',

success: function(returnObj){

$("#countTd").text("服务客户次数:" + returnObj.customerService + "    阅读报告篇数:" + returnObj.reportReadLog +"    撰写产品篇数:" + returnObj.htreport + "    完成任务情况:" + returnObj.task + "    工作申请情况:" + returnObj.applyTask);

}

});

public ModelAndView getAssessmentStaffEvaluationHandler(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException, ParseException {

String userId = Utils.trim(request.getParameter("userId"));

String startDate = Utils.trim(request.getParameter("startDate"));

String endDate = Utils.trim(request.getParameter("endDate"));

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

Map param = new HashMap();

param.put("inputid", userId);

param.put("beginDate", sdf.parse(startDate));

param.put("endDate", sdf.parse(endDate));

Response response1 = customerServiceService.getCustomerServiceCount(param);

Integer count1 = response1.getReturnInt();

Calendar c = Calendar.getInstance();

c.setTime(sdf.parse(endDate));

c.add(Calendar.DATE, 1);

Map param1 = new HashMap();

param1.put("userid", userId);

param1.put("beginDate", sdf.parse(startDate));

param1.put("endDate", c.getTime());

Response response2 = reportReadLogService.getReportReadLogCount(param1);

Integer count2 = (Integer) response2.getReturnObject();

Response response3 = htreportService.getHtreportCount(param1);

Integer count3 = (Integer) response3.getReturnObject();

Map param2 = new HashMap();

param2.put("createId", userId);

param2.put("flag", 1);

param2.put("startTime", sdf.parse(startDate));

param2.put("endTime", c.getTime());

Response response4 = taskService.getTaskCount(param2);

Integer count4 = (Integer) response4.getReturnObject();

Map param3 = new HashMap();

param3.put("createId", userId);

param3.put("beginDate", sdf.parse(startDate));

param3.put("endDate", c.getTime());

Response response5 = applyTaskService.getApplyTaskCount(param3);

Integer count5 = (Integer) response5.getReturnObject();

response.setContentType("text/json");

PrintWriter out = response.getWriter();

out.println("{\"customerService\":\"" + count1 + "\", \"reportReadLog\":\"" + count2 + "\", \"htreport\":\""

+ count3 + "\", \"task\":\"" + count4 + "\", \"applyTask\":\"" + count5 + "\"}");

out.flush();

out.close();

return null;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值