本文实例为大家分享了dropload插件上拉下滑加载数据的具体代码,供大家参考,具体内容如下
效果图:
1.导入js
dropload.min.js
zepto.min.js
2.后台查询
/** * 我找的劵 * * @return */ @Action("IFindTicket") public String IFindTicket() { try { FuTransaction transaction = fuTransactionService.findByUserId(userId); Mapmap = new HashMap (); map.put("transactionId", transaction == null ? 0L : transaction.getId()); List accounts = fuStockAccountService.findAccountByMap(0, 5, map); this.getActionContext().put("accounts", accounts); } catch (Exception e) { e.printStackTrace(); logger.equals(e); } return SUCCESS; } /** * 我找的劵数据 * * @return */ @Action("findTicketData") public String findTicketData() { try { FuTransaction transaction = fuTransactionService.findByUserId(userId); Map map = new HashMap (); map.put("transactionId", transaction == null ? 0L : transaction.getId()); List accounts = fuStockAccountService.findAccountByMap(0, Integer.MAX_VALUE, map); JSONObject json = new JSONObject(); JSONArray array = new JSONArray(); if (accounts.size() > 0) { for (FuStockAccount account : accounts) { JSONObject obj = new JSONObject(); obj.put("id", account.getId()); obj.put("openEquity", account.getOpenEquity()); obj.put("capitalAccount", account.getCapitalAccount()); obj.put("transactionStatus", account.getTransactionStatus()); obj.put("status", account.getTransactionStatus() == 0 ? "正在操作" : "已退劵"); obj.put("available", new DecimalFormat("#,###,##0.00").format(account.getAvailable() == null ? 0 : account.getAvailable())); obj.put("ableMoney", new DecimalFormat("#,###,##0.00").format(account.getAbleMoney() == null ? 0 : account.getAbleMoney())); obj.put("createTime", new SimpleDateFormat("yyyy.MM.dd").format(account.getCreateTime())); array.add(obj); } } json.put("array", array); write(json.toString()); } catch (Exception e) { e.printStackTrace(); logger.error(e); } return null; }
3.页面插件的使用
<%@ include file="../common/meta.jsp" %> <%@ include file="/WEB-INF/include/tagtld.jsp"%>${title}-我找的券 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ include file="../common/css.jsp"%>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持全福编程网。