Este artículo comparte el código específico del complemento de Dropage para retirar y cargar datos para su referencia. El contenido específico es el siguiente
Imagen de reproducción:
1. Importar JS
Dropload.min.js
Zepto.min.js <!-Elija uno de jQuery1.7 o superior o zepto, no los cite al mismo tiempo->
2. Consulta de backend
/ ** * Buscé * * @return */ @Action ("ifindTicket") public String ifindTicket () {try {FutRansaction Transaction = FutRansActionService.FindByUserId (userId); Map <string, object> map = new HashMap <String, Object> (); map.put ("transaccionId", transacción == null? 0l: transaccion.getId ()); Lista <FustockAccount> cuentas = fustockaccountservice.findaccountbymap (0, 5, mapa); this.getActionContext (). Put ("Cuentas", Cuentas); } catch (Exception e) {E.PrintStackTrace (); logger.equals (e); } return éxito; } / ** * Los datos que estoy buscando * * @return * / @Action ("findTicketData") public String findTicketData () {try {FutRansaction Transaction = FutRansactionService.FindByUserId (userId); Map <string, object> map = new HashMap <String, Object> (); map.put ("transaccionId", transacción == null? 0l: transaccion.getId ()); List <FustockAccount> cuentas = fustockaccountservice.findaccountbymap (0, integer.max_value, map); JsonObject json = new JsonObject (); JSONArray Array = new JsonArray (); if (cuentas.size ()> 0) {for (fustockacCount cuenta: cuentas) {jsonObject obj = new jsonObject (); obj.put ("id", cuenta.getId ()); obj.put ("OpenEquity", Account.getOpenequity ()); obj.put ("CapitalAccount", cuenta.getCapitalAcCount ()); obj.put ("TransactionStatus", Account.GetTransactionStatus ()); obj.put ("status", cuenta.getTransactionStatus ()); obj.put ("status", cuenta.getTransactionStatus () == 0? "Operando": "Retirado"); obj.put ("disponible", nuevo decimalFormat ("#, ###, ## 0.00"). Format (Account.getAVailable () == NULL? 0: Account.GetAVailable ())); obj.put ("Ablemoney", New DecimalFormat ("#, ###, ## 0.00"). Format (Account.GetAblEmoney () == NULL? 0: Account.GetAplEmoney ())); obj.put ("createTime", new SimpleDateFormat ("yyyy.mm.dd"). Format (Account.getCreateTime ())); array.add (obj); }} json.put ("Array", Array); escribir (json.ToString ()); } catch (Exception e) {E.PrintStackTrace (); logger.error (e); } return null; }3. Uso de complementos de página
< xmlns = "http://www.w3.org/1999/xhtml"> <fead> <meta http-equiv = "x-ua-compatible" content = "ie = edge"> <meta http-oquiv = "content-type" content = "text/html; charset = utf-8"/> <metta = " content = "width = dispositivo-width; inicial-escala = 1.0"> <meta name = "viewport" content = "width = dispositivo-width, altura = dispositivo-hevistencia, inital-escala = 1.0, máxima escala = 1.0, user-scalable = no;"> <meta name = "apple-mobile-web-appapable" contenido = "sí"> <meta meta nombre = "Apple-Mobile-Web-App-Status-Bar-Style" Content = "Black"> <Meta name = "Format-Detection" Content = "Telephone = no"> <%@ include file = "../ Common/Meta.jsp"%> <%@ include file = "/web-inf/include/tagtld.jsp"%> <title> $ {title} -the voucher i encontrando <title </title@%@%@ page lenguaje = "java" import = "java.util.*" PageEncoding = "utf-8"%> <%@ include file = "../ común/css.jsp"%> </head> <body> <div> <div> <div> <!-list-> <div> <table cellpadding = "0" celularpacing = "0"> <c: foreach items = "$ {cuentas {" stock "". <tr> <td> <div> <span> $ {stock.openequity}: $ {stock.capitalAcCount} <%-*** $ {fn: substring (stock.capitalAccount, 3,5)}-%> <//c: if test = "$ {stock.transactionStatus == 0}"> <a> operando <//c: c: c: c: " <c: if test = "$ {stock.transactionStatus == 1}"> <a> reembolsado </a> </c: if> </div> <div> <div> <span> valores de mercado de valores: <fmt: formatnumber valor = "$ {stock vacía? funds: <fmt:formatNumber value="${empty stock.ableMoney?0:stock.ableMoney}" pattern="#,###,##0.00"/> Yuan</span> </div> <div><a href="${ctx}/wxyqb/accountInfo.htm?id=${stock.id}"><img src = "../ Images_yqb/mejtou.png"/> </a> </div> </div> <div> publicado en: <fmt: formatDate value = "$ {stock.createTime}" patrón = "yyyyyy.mm.dd" // </iv> </td> </td> </ret> </c: </table> </table </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </body> <link href = "../ css/wxyqb.css" rel = "stylesheet" type = "text/css"/> <script " src = "$ {ctx} /js/dropload.min.js" type = "text/javascript"> </script> </html> <script> // dotload más $ (function () {var contar = 1; // show 5 var nums por página = 5; var pAGESTART = 0, pageEND = 0; // Dropload $ ('. : Window, DomUp: {domclass: 'dropeaad-up', domrefresh: '<div> ↓ despilf-down recth-custom contenido </div>', domupdate: '<div> ↑ Release Update-Custom Content </div>', domload: '<div> </span> Loading-custom Content ... </div>'}, {{span): 'Domreading:' DOMFROW '<div> ↑ para cargar más </div>', domload: '<div> <span> </span> cargando ... </div>', domnodata: '<div> no más comentarios </div>'}, loadupfn: function (me) {$ .AJAX ({type: 'post', url: '$ {ctx} /wxyqb/findTicketData {userId: $ {fuuser.id}}, DataType: 'json', éxito: function (data) {var result = ''; class = 'upth'> <span class = 'Bluecol Siz'> "+data.array [i] .Openequity+": "+data.array [i] .Openequity+" </span> "); if (data.array [i] .TransactionStatus == 0) {arrtext.push (" <a class = 'czing'> "+data.Array [i] .status+" </a> </div> ");} if (data.array [i] .TransactionStatus == 1 1) {arrtext.push (" <a class = 'bacing'> "+data.array [i] .status+" </a> </div> ");} arrtext.push (" <shiShiShix ("<ShiShiSh. class = 'Downlis'> <div class = 'Leftdown'> <span class = 'LeftDofir'> Valor de mercado de valores: "+data.array [i] .AVAilable+" yuan </span> </div> "); arrtext.push (" <divs class = 'rgtdown'> <a href = '$ {ctx} /wxyqb/accountinfo.htm?id = "+data.array [i] .id+"'> <img class = 'lftjt' src = '../images_yqb/mejtou.png' /// <a> </div> </iv> "); class = 'ticketdat'> publicado: "+data.array [i] .createTime+" </div> </td> </tr> "); resultado+= arrtext.Join ('');} // Para probar, retrasar 1 segundo de carga setTimeOut (function () {$ ('. FindTicIn'). html (resultado); // Cada vez que los datos se cargan, me cargan, me. }, 1000); '$ {ctx} /wxyqb/findticketData.htm', data: {userId: $ {fuuser.id}}, Datatype: 'json', éxito: function (data) {var longitud = data.array.length; if (longitude <= 5) {$ (". Dropload-Down"). class = 'SmallSize FirstTd'> "); arrtext.push (" <div class = 'upth'> <span class = 'blueCol siz'> "+data.array [i] .Openequity+": "+data.array [i] .Openequity+" </span> "); If (data.array [i] .transactionStatus == 0) {arrtex. class = 'czing'> "+data.array [i] .status+" </a> </iv> ");} if (data.array [i] .TransactionStatus == 1) {arrtext.push (" <a class = 'czing'> "+data.array [i] .status+" </a> </iv> ");} if (data.Array [i] .TransactionStatus == 1) {arrtext.push ("<a class = 'bacing'>"+data.Array [i] .Status+"</a> </div>"); "+data.array [i] .available+" yuan </span> </div> "); arrtext.push (" <div class = 'rgtdown'> <a href = '$ {ctx} /wxyqb/accountinfo.htm?id = "+data.array [i] .id+"> <IMG class =' lftJt ' src = '../images_yqb/mejtou.png' //// </a> </div> </div> "); arrtext.push (" <div class = 'ticketdat'> publicado: " +data.array [i] .createTime +" </tiv> </td> </tr> "); resultado += artext.Join (''); data.array.length) {// bloquear me.lock (); función (xhr, type) {alerta ('Ajax Error!');Lo anterior es todo el contenido de este artículo. Espero que sea útil para el aprendizaje de todos y espero que todos apoyen más a Wulin.com.