//往上滑是调用分页 function Ajax(currPage, pageSize) { // ajax后台交互String currPage,String pageSize var el, Plist, i; el = document.getElementById(‘thelist‘); var cancle = function(options) { var pattern = ‘${pageContext.request.contextPath}/integralParadise/userIntegralRecordsPaging?currPage=:currPage&pageSize=:pageSize‘; for ( var key in options) { pattern = pattern.replace(‘:‘ + key, options[key] || ‘‘); } return pattern; } $.post(cancle({ currPage : currPage, pageSize : pageSize }), function(result) { var integralRecord = result.page; if (integralRecord.length > 0) { $("#currPage").val(result.currPage + 1); $("#pageSize").val(result.pageSize); //追加信息 var divItem = ""; $.each(integralRecord, function(index, detail) { if(detail.integral != 0){ var type = detail.typeId; var integral = detail.integral; var now = new Date(detail.operatorTime); var time = now.Format("yyyy-MM-dd"); var positiveOrNegative =detail.positiveOrNegative ; var operation = detail.operation; var money = parseInt(detail.money); var rate = detail.rate; var name; switch (type) { case 1: name="账号绑定奖励"; break; case 2: name="出借奖励"; break; } divItem += "<div class=‘dtb_item‘><div class=‘dtb_l‘><h3>" +name+ "</h3><p>"+time+"</p></div><div class=‘dtb_m‘>"; if(type == 11){ divItem +="<p class=‘i_msg purple‘>" +"+"+integral+"</p></div></div>"; }else if(positiveOrNegative == false){ divItem +="<p class=‘i_msg green‘>" +"-"+integral+"</p></div></div>"; }else{ divItem +="<p class=‘i_msg red‘>" +"+"+integral+"</p></div></div>"; } } }); $("#thelist").append(divItem); $(".pullUpLabel").html("") myScroll.refresh(); } else { $(‘.pullUpLabel‘).html(‘没有更多记录‘); <c:if test="${showmessage <= 0 }">$("#dateTip").html("2016年9月7日前的记录暂时无法显示");</c:if> } }); }
这段代码最后用了JSTL和EL,但是这个段JS是在JSP页面中,如果JS不在JSP中要再JS设定使用该JS的JSP页面。
也就是说服务器端把JSTL和EL的值先转化后传到JS中,JS已经得到了静态的值来执行。
<c:if test="${showmessage <= 0 }">$("#dateTip").html("2016年9月7日前的记录暂时无法显示");</c:if>
获取EL的值
var result = "${showmessage}";
时间: 2024-10-20 13:15:05