欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

jsp页面调用服务器端接口分页显示数据的问题

程序员文章站 2023-12-25 21:23:39
...

index.jsp页面:


<li><a href="youhui/youhuiindex.jsp?page=1 "><img src="images/youhuiquan.png"></img><br/></a>优惠券</li>


youhuiindex.jsp页面:


<%@ page language="java" import="java.util.*,java.lang.* " pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt" %>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>


<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Integer ssh=Integer.parseInt(request.getParameter("page"))+1;
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   
    <title>My JSP 'youhuiindex.jsp' starting page</title>
   
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <link rel="stylesheet" type="text/css" href="css/bijia/bijiaindex.css">
<script type='text/javascript' src='js/jquery-latest.js'></script>
<script type="text/javascript">
var murl='http://192.168.1.122:8080/bjmobile/viewCoupons.do';
var page='<%=request.getParameter("page")%>';
//alert(page);
//page=1+parseInt(page);
murl=murl+'?page='+page;
$(function() {
     var items='';
     $.post(murl,function(data){
         var json=eval("(" + data + ")");
         //alert(data);
         //alert(json["couponList"][0].title);
         //alert(json.length);
         for(var i=0;i<json["couponList"].length;i++){
             items=items+'<a href="#" style="text-decoration: none"><div class="item1">['+json["couponList"][i].stronename+']'+json["couponList"][i].titile+'    > </div></a>';
         }
         $("#item").html(items);           
     });
});
</script>

  </head>
 
  <body>
    <div class="head1">
    <input class="loc1" type="submit" value="返回" onclick="javascript:window.location.href='index.jsp'">
    <font class="loc2">优惠券</font>
    </div>
    <div id="item"></div>
    <hr/>
    <div><a href="youhui/youhuiindex.jsp?page=
<c:out value='<%=(ssh)%>'/> ">下一页</a> 第 <%=(ssh-1)%> 页</div>
  </body>
</html>

  • jsp页面调用服务器端接口分页显示数据的问题
            
    
    博客分类: wap jsp分页json数组服务器端接口 
  • 大小: 74.3 KB

上一篇:

下一篇: