?? list.jsp
字號:
<%@ page language="java" contentType="text/html; charset=GB2312" pageEncoding="GB2312"%>
<%@page import="com.ideas.util.*,java.util.*"%>
<%
//超時提示
if((String)session.getAttribute("login")==null) {
response.sendRedirect("../session.htm");
}
%>
<jsp:useBean id="myBean" scope="page" class="com.ideas.bean.artBean"/>
<%
int intPageSize; //一頁顯示的記錄數
int intRowCount; //記錄總數
int intPageCount; //總頁數
int intPage; //待顯示頁碼
String strPage;
//設置一頁顯示的記錄數
intPageSize = Configuration.Number_shown;
//取得待顯示頁碼
strPage = request.getParameter("page");
if(strPage==null){//表明在QueryString中沒有page這一個參數,此時顯示第一頁數據
intPage = 1;
}
else{//將字符串轉換成整型
intPage = java.lang.Integer.parseInt(strPage);
if(intPage<1) intPage = 1;
}
int recno=(intPage-1)*intPageSize+1;
//DBConnectionManager connMgr=DBConnectionManager.getInstance();
//Connection con = connMgr.getConnection(Configuration.ConnectionPoolName);
//創建數據庫連接
if (!myBean.getMyConnPool()) {
out.println("不能獲取數據庫連接.");
return;
}
//取得當前頁的數據
Vector vect = myBean.getCurPage(intPage,intPageSize);
//獲取記錄總數
intRowCount = Integer.parseInt((String)vect.get(0));
//記算總頁數
intPageCount = Integer.parseInt((String)vect.get(1));
//調整待顯示的頁碼
if(intPage>intPageCount) intPage = intPageCount;
%>
<html>
<head>
<title>新聞評論</title>
<link rel="STYLESHEET" type="text/css" href="../css/yj.css">
</head>
<body>
<center><H1>文章列表</H1></center>
<h2> 第<%=intPage%>頁 共<%=intPageCount%>頁(<%=intRowCount%>條) <a href="list.jsp?">首頁</a> <%if(intPage>1){%><a href="list.jsp?&page=<%=intPage-1%>">上一頁</a><%}%> <%if(intPage<intPageCount){%><a href="list.jsp?&page=<%=intPage+1%>">下一頁</a><%}%> <a href="list.jsp?&page=<%=intPageCount%>">尾頁</a> <a onclick="javascript:window.location.reload();" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';" style="cursor:hand;" ><font color="blue">刷新數據</font></a></h2>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="40" align="center" >序號</th>
<th width="100" align="center" >名稱</th>
<th width="70" align="center" >菜單級別</th>
<th width="290" align="center" >所屬菜單</th>
<th width="250" align="center" >新聞標題</th>
<th width="80" align="center">〖操作〗</th>
<tr>
<%
if(intPageCount>0){
for (int line=2;line<vect.size();line++) {
Hashtable hash = (Hashtable)vect.get(line);
String mode=null;
if (line%2==1)
mode="row3";
else
mode="row1";
String id = (String)hash.get("id");
String islock = (String)hash.get("isuse");
String t = "已通過";
if(islock.equals("0"))t = "未通過";
//菜單變量
String menuid = (String)hash.get("menuid");
String menuname = "";
String menufloor = (String)hash.get("menufloor");
//取得一級菜單名稱
if(menufloor.equals("1"))
{
menuname = myBean.toName("menu1","id","name",menuid);
}
//取得二級菜單名稱
if(menufloor.equals("2"))
{
menuname = myBean.toName("menu2","id","name",menuid);
menuid = myBean.toID("menu2","id","id1",menuid) + "";
menuname = myBean.toName("menu1","id","name",menuid) + "\\" + menuname;
}
//取得三級菜單名稱
if(menufloor.equals("3"))
{
menuname = myBean.toName("menu3","id","name",menuid);
menuid = myBean.toID("menu3","id","id2",menuid) + "";
menuname = myBean.toName("menu2","id","name",menuid) + "\\" + menuname;
menuid = myBean.toID("menu2","id","id1",menuid) + "";
menuname = myBean.toName("menu1","id","name",menuid) + "\\" + menuname;
}
String file = (String)hash.get("file");
String name = (String)hash.get("name") ;
%>
<tr>
<td height=21 align="center" class="<%=mode%>" ><%=recno++%></td>
<td align="left" class="<%=mode%>" ><%=name%></td>
<td align="center" class="<%=mode%>" ><%=menufloor%></td>
<td align="left" class="<%=mode%>" ><%=menuname%></td>
<td align="left" class="<%=mode%>" ><%=hash.get("title")%></td>
<td class="<%=mode%>" ><A onclick="edit('<%=file%>');"style="cursor:hand;" class="hold">『相關評論』</A>
</td>
</tr>
<%
}
}//end for%>
</table><form name=form1 action="" method=post></form>
<%
//connMgr.freeConnection(Configuration.ConnectionPoolName, con);
myBean.releaseMyConnPool();
%>
<script>
function edit(id)
{
document.all.form1.action = "comment.jsp?type=2&articleid="+id+"&page=<%=intPage%>";
document.all.form1.submit();
}
</script>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -