📄 select.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.util.*"%>
<%@ page import="zd.bbs.*"%>
<jsp:useBean id="dao" scope="page" class="zd.bbs.NoteDAOImpl" />
<html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>正大软件学院论坛</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<%
//request.setCharacterEncoding("gbk");
//String m_name2=new String(request.getParameter("m_name2").getBytes("iso-8859-1"));//接收模块2的名称
session.setAttribute("username",(session.getAttribute("username")));
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr style="background-image:url(images/bg_top.jpg)">
<td align="left"><img src="images/top_01.jpg" width="347" height="101" /><img src="images/top_02.jpg" width="330" height="101" /><img src="images/top_03.jpg" width="323" height="101" /></td>
<td align="right"> </td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#BED6F9" id="login">
<tr>
<td width="50%" height="25">
<%
if(session.getAttribute("username")==null||session.getAttribute("username")==""){
%>
<%@include file="lg.jsp" %>
<%
}else{
out.print(" "+session.getAttribute("username")+"你已登录,可以发贴或是留言");
}
%>
</td>
<td width="50%"><marquee direction="left" scrollamount="2">论坛公告 修改乱码帖的简单方法,并招募志愿者(2007-4-9)</marquee></td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="5">
<tr>
<td colspan="2" id="nav"> <img src="images/icon_nav.jpg" width="9" height="9" /> <a href="index.jsp">正大软件职业技术学院论坛</a></td>
</tr>
<tr>
<td align="center" height="25" colspan="2" id="online"><span class="menu_tt">正大软件职业技术学院在线查询</span></td>
</tr>
<tr>
<td height="25"><a href="Talk.jsp"><img src="images/btn_fbht.jpg" alt="发表一个新主题" width="72" height="21" border="0" /></a>
<form id="form2" name="form2" method="post" action="#">
正大快搜:
<input name="keyword" type="text" size="20" />
<input type=submit value="查询">
</form></td>
<td align="right"><img src="images/icon_bz.jpg" width="15" height="16" align="absmiddle" /> 无版主</td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#F4F9FD">
<tr>
<td height="40">
<td width="300" align="right"><span class="today"><strong>精华</strong></span><strong> | 在线 | 事件 | 权限 | 管理</strong></td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bordercolor="#B2D3FE" bgcolor="#B2D3FE">
<%
String keyword=request.getParameter("keyword");
List all=null;
try{
all=DAOFactory.getNoteDAOInstance().queryByLike(keyword);
}catch(Exception e){}
out.println("keyword="+keyword);
int nowPages;//当前页
int pages;//请求页数
int countPerPage = 10 ; //每页显示条数
int pageCount;//总页数
int recordCount=all.size(); //recordCount为总记录数
//recordCount=DAOFactory.getNoteDAOInstance().sum1(keyword);
pageCount = (int)Math.ceil((recordCount + countPerPage-1) / countPerPage);//算出总页数
//得到请求页
if(request.getParameter("pages") == null){
pages = 1;
}else{
pages = new Integer(request.getParameter("pages")).intValue();
}
//得到当前实际页面
if(pages > pageCount){
nowPages = 1;
}else{
nowPages = pages;
}
%>
<tr>
<td width="40" height="25" align="center" background="images/bg_tt.gif" bgcolor="#E4F1FA"><span class="menu_tt">状态</span></td>
<td align="center" background="images/bg_tt.gif" bgcolor="#F4F9FD"><span class="menu_tt">主题</span></td>
<td width="80" align="center" background="images/bg_tt.gif" bgcolor="#E4F1FA" class="menu_tt">作 者</td>
<td width="70" align="center" background="images/bg_tt.gif" bgcolor="#F4F9FD" class="menu_tt">回复</td>
<td width="200" align="center" background="images/bg_tt.gif" bgcolor="#E4F1FA" class="menu_tt">发表时间</td>
</tr>
<% //String list_sql="select * from talk where model_id2='"+lid+"'";%>
<%
Iterator iter = all.iterator() ;
while(iter.hasNext())
{
Note note = (Note)iter.next() ;
//i++ ;
// 进行循环打印,打印出所有的内容,以表格形式
// 从数据库中取出内容
int talk_id=note.getTalk_id();
String title = note.getTitle();
String username = note.getUsername();
String data_time = note.getData_time();
int model_id2= note.getModel_id2();
if(keyword!=null)
{
// 需要将数据返红
title = title.replaceAll(keyword,"<font color=\"red\">"+keyword+"</font>") ;
username = username.replaceAll(keyword,"<font color=\"red\">"+keyword+"</font>") ;
data_time = data_time.replaceAll(keyword,"<font color=\"red\">"+keyword+"</font>") ;
}
//ResultSet rs=list.eQ("select * from answer=");
%>
<tr>
<td height="25" align="center" bgcolor="#E4F1FA"><img src="images/tl_kf.jpg" width="16" height="11" /></td>
<td bgcolor="#F4F9FD" id="list_zt"><a href="content.jsp?cid=<%=talk_id%>&l_m_name2=查询&m_id=<%=model_id2%>"><%=title%></a> </td>
<td align="center" bgcolor="#E4F1FA"><%=username%></td>
<td align="center" bgcolor="#F4F9FD"><%=DAOFactory.getNoteDAOInstance().query_count(talk_id)%></td>
<td align="center" bgcolor="#E4F1FA"><%=data_time %> </td>
</tr>
<%}%>
<table width="99%" height="30" border="0" align="center" cellpadding="0" cellspacing="0">
<form method="get">
<tr align="right">
<td colspan="6">共有<font color=red><%= recordCount %></font>条记录 当前<font color=red><%= nowPages %>/<%= pageCount %></font>页
<% if(pageCount > 1){ %>
<% if(pages > 1){%>
<a href="list.jsp?keyword=<%=keyword %>">首页</a>
<%}if(pages < pageCount){%>
<a href="?pages=<%= nowPages+1 %>&keyword=<%=keyword %>">下一页</a>
<%}if(pages != 1){%>
<a href="?pages=<%= nowPages - 1 %>&keyword=<%=keyword %>">上一页</a>
<%}%>
<a href="?pages=<%= pageCount %>&keyword=<%=keyword %>">尾页</a>
<% } %>跳转到
<select name="pages" onChange="javascript:this.form.submit();">
<% for(int i=1;i<=pageCount;i++){%>
<option value="<%= i %>" <% if(nowPages == i){%>selected<% } %>><%= i %></option>
<% } %>
</select>页</td>
</tr>
<input type="hidden" name="keyword" value="<%=keyword %>" >
</form>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="24" background="images/bg_tt.gif"> <span class="menu_tt">-=> 论坛图例 </span></td>
</tr>
<tr>
<td height="40" bgcolor="#F4F9FD"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/tl_kf.jpg" width="16" height="11" /> 开放的主题</td>
<td><img src="images/tl_rt.jpg" width="16" height="17" /> 回复超过10帖</td>
<td><img src="images/tl_sd.jpg" width="16" height="14" /> 锁定的主题</td>
<td><img src="images/tl_gd.jpg" width="15" height="17" /> 固顶的主题</td>
<td><img src="images/tl_zgd.gif" width="17" height="17" /> 总固顶的主题</td>
<td><img src="images/tl_jh.jpg" width="17" height="16" /> 精华帖子</td>
<td><img src="images/tl_tp.gif" width="13" height="15" /> 投票帖子</td>
</tr>
</table></td>
</tr>
<tr>
<td height="20"> </td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" class="bottom">
<tr>
<td><p>版权所有©重庆正大软件职业技术学院<br />
<br />
技术支持:重庆正大软件职业技术学院网络技术系 渝ICP备07001号 </p></td>
<td width="80"><img src="images/bg_logo.gif" width="58" height="58" /></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -