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中响应的示例分析”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联成都网站设计公司行业资讯频道!
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
当前文章:ajax在jquery中请求和servlet中响应的示例分析-创新互联
当前URL:http://www.jxjierui.cn/article/ipidd.html


咨询
建站咨询
