下面我就為大家分享一篇淺談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中的請求(詳細教程)的詳細內容。更多資訊請關注PHP中文網其他相關文章!