JSP 页面分页代码示例-2

来源:互联网 发布:域名转入万网 编辑:程序博客网 时间:2024/05/21 08:41

<%@ page language="java" contentType="application/vnd.wap.xhtml+xml;charset=UTF-8" %>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>MP3</title>
  </head>
  <body>
   <jsp:include page="logo.jsp" flush = "true"/><hr/>
   <%String path = (String)request.getAttribute("path").toString();
     String error = (String)request.getAttribute("error").toString();
     String name = new String(request.getAttribute("name").toString().getBytes("iso-8859-1"),"utf-8");
     String songclass = (String)request.getAttribute("songclass").toString();
     int pageNo = Integer.parseInt(request.getAttribute("pageNo").toString());
      int pageCount = Integer.parseInt(request.getAttribute("pageCount").toString());
      if(error!=null&&error.equals("error")){%>
    <p>页码错误</p>
    <%}else{
     out.println(name);
      }
    %><br/>
   <%int i = 1; %>
    <logic:iterate id="list" name = "newRecommend" scope = "request">
     <%=i++ %>)${list.songname }<br/>&nbsp;&nbsp;${list.songsize }
     <a href = "<%=path %>${list.songpath }">下载</a><br/>
    </logic:iterate>
   <%if(pageNo>1){%><a href="song.do?method=newRecommend&page=<%=pageNo-1%>&id=<%=songclass %>&name=<%=name %>">上一页</a><br/><%}%>
    <%if(pageNo<pageCount-1){%><a href="song.do?method=newRecommend&page=<%=pageNo+1%>&id=<%=songclass %>&name=<%=name %>">下一页</a><%}%><br/>
   
    <form action = "song.do?method=newRecommend&id=<%=songclass %>&name=<%=name %>" method = "post">
     <input type = "text" size = "3" name="page"/>/<%=pageCount-1%>
     <input type = "submit" value = "跳转" style="background:#fff; solid #333333; color:#ccccccc; width:40;"/>
    </form>
   
   <br/><a href = "singer.do?method=Songclass">返回上一级</a>
   <br/><a href = "index.jsp">返回首页</a>
 <hr/><jsp:include page="time.jsp" flush = "true"/>
  </body>
</html>

原创粉丝点击