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="返回" οnclick="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>