📄 sorts.jsp
字号:
<% String toptitle="请选择您要观看的内容"; %>
<%@ include file="rscoon.jsp"%>
<%@ include file="mztop.jsp"%>
<TABLE align=center bgColor=#ffffff border=0 cellPadding=0 cellSpacing=0
width=766>
<TBODY>
<TR>
<TD background="" height=453 vAlign=top width=186>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD height=38 vAlign=top>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=180>
<TBODY>
<TR>
<TD background=images/tpbg.gif
height=38> </TD>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD><IMG height=44 src="images/rj-zcfgtp.gif"
width=180></TD>
</TR></TBODY></TABLE>
<TABLE width=180 height="25" border=0 cellPadding=0 cellSpacing=0>
<TR>
<TD bgColor=#f9f9f9>
<%@ include file="leftmz.jsp"%></TD>
</TR>
</TABLE></TD>
<TD bgColor=#f9f9f9 vAlign=top width=580>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD background=""> </TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD>
<DIV align=right><IMG height=60 src="images/rj-zcfg.gif"
width=580></DIV></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD background=images/rj-bg4.gif bgColor=#ffffff height=23>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="98%">
<TBODY>
<TR>
<TD class=wz6 height=14 width="4%"></TD>
<TD class=wz6 vAlign=bottom width="96%">当前位置:<a href="index.jsp">首页</a>
>> <FONT
color=#663300><a href="sorts.jsp">政策法规</a></FONT></TD>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD background="" height=5></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD> </TD></TR></TBODY></TABLE>
<TABLE width="100%" border=0 align="center" cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD height=334 width="6%"> </TD>
<TD vAlign=top width="94%">
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<%String id=request.getParameter("id");
String sqlname;
int intPageSize;
int intRowCount;//记录总数
int intPageCount;//总页数
int intPage;//页面参数
String strPage;//定义变量用来传递page
int i,j;
intPageSize=10;//定义每页显示10条记录
strPage=request.getParameter("page");//取得当前的页码
if(strPage==null){//判断初始页面,如果没有显示记录,就置为第一页
intPage=1;
}else{
intPage=Integer.parseInt(strPage);//将strPage转化为整数
if(intPage<1) intPage=1;
}
if(id!=null){
sqlname="select count(title) from scott.allarti where frominto='"+id+"' order by times desc";
}else{
sqlname="select count(title) from scott.allarti order by times desc";
}
ResultSet rt=stmt.executeQuery(sqlname);
rt.next();
intRowCount=rt.getInt(1);//取得整数保存与intRowCount变量中
intPageCount=(intRowCount+intPageSize-1)/intPageSize;//计算出总页数(记录总数+每页显示的记录-1)/每页显示的记录)
if(intPage>intPageCount)
intPage=intPageCount;
if(id!=null){
sqlname="select * from scott.allarti where frominto='"+id+"' order by times desc";
}else{
sqlname="select * from scott.allarti order by times desc";
}
ResultSet rs=stmt.executeQuery(sqlname);//执行sql,按照时间先后排序显示
i=(intPage-1)*intPageSize;
for(j=0;j<i;j++)
rs.next();
%>
<%-- 设置intPage参数 --%>
<%if(intRowCount==0){%>
<tr><td>对不起,此版块暂无内容</td></tr>
<%}else{
i=0;
while(i<intPageSize && rs.next()){%>
<%-- 显示每页的数据 (根据i的值判断每页的5条记录) --%>
<TR><TD height=20 width="6%"> <DIV align=center><IMG height=10 src="images/rj-tp3.gif" width=6></DIV></TD>
<TD class=wz9 height=20 width="94%"><a href="listarti.jsp?id=<%=rs.getString("id")%>" target="_blank"><%=rs.getString("title")%></a><IMG height=10
src="images/hot.gif" width=20></TD>
</TR>
<% i++;//通过I循环设置每页的页数
}
}
rs.close();
stmt.close();
conn.close();
out.print("</td></tr></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>");
%>
<%@ include file="foot.jsp"%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -