📄 list.jsp
字号:
<script language=javascript>
<!--
var startTime,endTime;
var d=new Date();
startTime=d.getTime();
//-->
</script>
<html>
<head>
<title>企业内部管理信息平台∷分类查看</title>
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page language="java" import="java.sql.*"%>
<%@ page language="java" import="java.util.*"%>
<jsp:useBean id="sqlbean" scope="page" class="news.sql_data"/>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<link rel="stylesheet" href="newstyle.css" type="text/css">
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<style type="text/css">
<!--
.style2 {
color: #000066;
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style3 {
font-family: Verdana, Arial, "??ì?";
font-weight: bold;
color: #000066;
}
.style5 {
font-family: Arial, Helvetica, sans-serif;
color: #000066;
font-weight: bold;
}
-->
</style>
</head>
<body bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<jsp:include page="header.jsp"/>
<SCRIPT>
var old_bg="";
function inStyle(obj)
{
old_bg=obj.style.background;
obj.style.background="#FFFF99";
}
function outStyle(obj)
{
obj.style.background=old_bg;
}
</SCRIPT>
<%String sortid=new String(request.getParameter("sortid").getBytes("ISO8859_1"),"GBK");
String rootid=new String(request.getParameter("rootid").getBytes("ISO8859_1"),"GBK");
String sql = "Select * FROM class where parentclass='"+rootid+"' order by id";
ResultSet RS = sqlbean.executeQuery(sql);
%>
<TABLE width="780" border=0 align=center cellPadding=0 cellSpacing=0>
<TR>
<TD width="23%" vAlign=top><TABLE width="100%" cellSpacing=0 cellPadding=0 align=center border=0>
</table>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr >
<td height=24 align="center" vAlign=middle><span class="style5">
<%if (sortid.equals("all")) {%>-=下属部门=-<%
}else{%><A href='list.jsp?rootid=<%=rootid%>&sortid=all'>-=返回上级=-</a><%}%></span></td>
</tr>
<%while (RS.next()){
if (sortid!=null&&RS.getString("class").equals(sortid)){%>
<tr >
<td vAlign=top onmouseover="this.className='bg'" onmouseout="this.className='bg1'" height=24>
<img src=images/hot_p.gif align=absmiddle> <B><FONT color=red><%=RS.getString("class")%></font></B>
</td>
</tr>
<%}
else{%>
<tr><td style="DISPLAY: none" bgColor=#fefdf5>
</td></tr>
<tr >
<td vAlign=top onmouseover="this.className='bg'" onmouseout="this.className='bg1'" height=24>
<img src=images/hot_p.gif align=absmiddle> <A href='list.jsp?sortid=<%=RS.getString("class")%>&rootid=<%=RS.getString("parentclass")%>'><%=RS.getString("class")%></a>
</td>
</tr><%}}
RS.close();%>
<tr><td style="DISPLAY: none" bgColor=#fefdf5>
</td></tr>
<tr><td style="DISPLAY: none" bgColor=#fefdf5>
</td></tr>
</table>
<TABLE width="100%" cellSpacing=0 cellPadding=0 align=center border=0>
<TR>
<form method=post name=form action=search.jsp>
<td align="center" class=shadow width="50%"><input name="keyword" type="text" onblur="if (value ==''){value='请输入要查询的关键字'}" onmouseover=this.focus() onfocus=this.select() onclick="if(this.value=='请输入要查询的关键字')this.value=''" size="10" class="inputbody" value=请输入要查询的关键字>
<select name="field" size="1" class="inputbody" id="select0">
<option value="all" selected>所有</option>
<option value="title">标题</option>
<option value="content">内容</option>
</select>
<select size="1" name="kt" class="inputbody">
<option value="all" selected>全部类别</option>
<%RS = sqlbean.executeQuery("select * from class where parentid=0");
while(RS.next()){%>
<option value="<%=RS.getString("class")%>"><%=RS.getString("class")%></option>
<%}
RS.close();%>
</select>
<input name="Submit" type="Submit" value="搜索..." class="button"></td></form>
</TR>
</table>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td align="center" vAlign=middle style="LINE-HEIGHT: 130%; font-size: 9pt;"><span class="style3">-=本类浏览排行=-</span></td>
</tr>
<tr>
<td vAlign=top style="LINE-HEIGHT: 130%; font-size: 9pt;">
<%
if (sortid.equals("all"))
{sql = "Select id,title,hit FROM news where parentclass='"+rootid+"' order by hit desc";}
else{sql = "Select id,title,hit FROM news where class='"+sortid+"' order by hit desc";}
RS = sqlbean.executeQuery(sql);
int i=0;
while (RS.next()&&(i<10)){%>
<img src=images/ico1.gif> <A href='show.jsp?id=<%=RS.getString("id")%>' class="TableLink"><%
String title=RS.getString("title");
if (title.length()>11){
title=title.substring(0,10);
out.println(title+"...");}else{
out.println(title);}%></a> <FONT color=#999999><%=RS.getString("hit")%></font><BR>
<%i++;}
RS.close();%></td>
</tr>
</table>
<TABLE width="100%" cellSpacing=0 cellPadding=0 align=center border=0>
</table>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td align="center" vAlign=top style="LINE-HEIGHT: 130%; font-size: 9pt;"><span class="style2">-=总浏览排行=-</span></td>
</tr>
<tr>
<td vAlign=top style="LINE-HEIGHT: 130%; font-size: 9pt;">
<% sql = "Select top 10 id,title,hit FROM news order by hit desc";
RS = sqlbean.executeQuery(sql);
while (RS.next()){%>
<img src=images/ico1.gif> <A href='show.jsp?id=<%=RS.getString("id")%>' class="TableLink"><%
String title=RS.getString("title");
if (title.length()>11){
title=title.substring(0,10);
out.println(title+"...");}else{
out.println(title);}%></a> <FONT color=#999999><%=RS.getString("hit")%></font><BR>
<%}
RS.close();%></td>
</tr>
</table> </TD>
<TD width="1"><img src="" width=1 height=1></TD>
<TD width="87%" vAlign=top>
<TABLE width="98%" cellSpacing=1 cellPadding=0 align=center border=0>
<TR>
<Th width="70%" align="left">标题</Th>
<Th noWrap>整理日期</Th>
<Th noWrap>浏览次数</Th>
</TR><%if (sortid.equals("all"))
{sql = "Select * FROM news where parentclass='"+rootid+"' order by id desc";}
else{sql = "Select * FROM news where class='"+sortid+"' order by id desc";}
RS = sqlbean.executeQuery(sql);
int intPageSize; //一页显示的记录数
int intRowCount; //记录总数
int intPageCount; //总页数
int intPage; //待显示页码
java.lang.String strPage;
//int i;
//设置一页显示的记录数
intPageSize = 5;
//取得待显示页码
strPage = request.getParameter("page");
if(strPage==null){//表明在QueryString中没有page这一个参数,此时显示第一页数据
intPage = 1;
}
else{//将字符串转换成整型
intPage = java.lang.Integer.parseInt(strPage);
if(intPage<1) intPage = 1;
}
RS.last();
intRowCount = RS.getRow();
//记算总页数
intPageCount = (intRowCount+intPageSize-1) / intPageSize;
//调整待显示的页码
if(intPage>intPageCount) intPage = intPageCount;
if(intPageCount>0){
//将记录指针定位到待显示页的第一条记录上
RS.absolute((intPage-1) * intPageSize + 1);
//显示数据
i = 0;
while((i<intPageSize && !RS.isAfterLast())){
String news2= new String(RS.getString("news").getBytes("ISO-8859-1"),"GBK");%>
<TR onmouseover=inStyle(this) style="BACKGROUND: #F7F7F7" onmouseout=outStyle(this) >
<TD height=23> <img src="images/arrow.gif" align="absmiddle"> <a href=show.jsp?id=<%=RS.getString("id")%>><%=RS.getString("title")%></a></TD>
<TD noWrap align=center><%=RS.getDate("d")%></TD>
<TD align=center noWrap><%=RS.getString("hit")%></TD>
</TR>
<TR >
<TD height=25 style="LINE-HEIGHT: 150%;" colSpan=3><font color="green"> 所属类别:</font><%=RS.getString("parentclass")%>--><%=RS.getString("class")%><%//=news2%></TD>
</TR>
<TR >
<TD height=23 colspan="3"><font color="green"> 出处:</font> <%=RS.getString("author")%></TD>
</TR>
<TR>
<TD height=2 colSpan=3></TD>
</TR> <%
RS.next();
i++;}
}
RS.close();
%>
<TR >
<TD height=22 colSpan=3>第<%=intPage%>页/共<%=intPageCount%>页
<%if(intPage>1){%><a href="list.jsp?page=<%=intPage-1%>&rootid=<%=rootid%>&sortid=<%=sortid%>">上一页</a><%}%>
<%if(intPage<intPageCount){%><a href="list.jsp?page=<%=intPage+1%>&rootid=<%=rootid%>&sortid=<%=sortid%>">下一页</a><%}%>
请选择页码:<select name="page" onChange="MM_jumpMenu('parent',this,0)">
<option value="list.jsp?page=<%=intPage%>&rootid=<%=rootid%>&sortid=<%=sortid%>" selected><%=intPage%></option>
<%int j;
for (j=1;j<=intPageCount;j++){%>
<option value="list.jsp?page=<%=j%>&rootid=<%=rootid%>&sortid=<%=sortid%>"><%=j%></option>
<%}%>
</select></TD>
</TR>
</table>
<BR style="OVERFLOW: hidden; LINE-HEIGHT: 3px">
</TD>
</TR></TABLE><div align="center"><jsp:include page="bottom.jsp"/></div>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -