📄 search.jsp
字号:
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="include.jsp"%>
<HTML><HEAD><TITLE><%=title%></TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<LINK href="css/css.css" rel=stylesheet type=text/css>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 text=#000000 topMargin=0>
<script Language="JavaScript">
<!--
function isspacestring(mystring)
{ var istring=mystring;
var temp,i,strlen;
temp=true;
strlen=istring.length;
for (i=0;i<strlen;i++)
{
if ((istring.substring(i,i+1)!=" ")&(temp))
{ temp=false; }
}
return temp;
}
function firstisspace(mystring)
{ var istring=mystring;
var temp,i,strlen;
temp=false;
if (istring.substring(0,1)==" ")
{ temp=true; }
return temp;
}
function check_input(theForm)
{
if ((theForm.content.value == "")|(firstisspace(theForm.content.value)))
{
alert("请输入查询的条件.不能以空格开头");
theForm.content.focus();
return (false);
}
if ((theForm.content.value == "")|(isspacestring(theForm.content.value)))
{
alert("请输入查询的条件.");
theForm.content.focus();
return (false);
}
}
//-->
</script>
<CENTER>
<TABLE border=0 cellPadding=0 cellSpacing=0 height=81 width=776>
<TBODY>
<TR>
<TD width=776>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD height=82 background="img/index/b-banner.jpg"><FONT SIZE="5" COLOR="ffffff"><B>新闻管理系统</B></FONT></TD>
</TR>
<TR>
<TD height=23>
<TABLE border=0 cellPadding=0 cellSpacing=0 class=font-12
height="100%" width="100%" background="img/index/nav1.jpg">
<TBODY>
<TR>
<TD align=middle width=50><A class=w href="index.jsp">首 页</A></TD>
<%CategoryMgr categoryMgr = new CategoryMgr();
Collection c = categoryMgr.getAll();
Iterator iterator = c.iterator();
while (iterator.hasNext()) {
Category category = (Category) iterator.next();
%>
<TD align=middle width=50><A class=w
href="list.jsp?id=<%=category.getId()%>"><%=category.getName()%></A></TD>
<%}%>
</TR></TBODY></TABLE></TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 height=26 width=776>
<TBODY>
<TR>
<TD background="img/index/nav.jpg" vAlign=center>
<TABLE align=center border=0 cellPadding=0 cellSpacing=0
style="FONT-SIZE: 12px" width="100%">
<FORM action="search.jsp" method=post name=form1 onsubmit="return check_input(this)">
<TBODY>
<TR>
<TD align=middle vAlign=center width=170>
<SCRIPT language=JavaScript>
today=new Date(); function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray("<font color=RED>星期日</font>","星期一","星期二","星期三","星期四","星期五","<font color=GREEN>星期六</font></font>"); document.write(today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日"," ",d[today.getDay()+1]);
</SCRIPT>
</TD>
<TD align=middle width=322> </TD>
<TD align=middle width=284>本站搜索: <INPUT name=content size=16
style="FONT-SIZE: 12px"><INPUT name=Submit type=submit value=GO>
</TD></TR></FORM></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=776>
<TBODY>
<TR>
<TD bgColor=#999999> </TD>
<TD width=180><IMG border=0 height=22 src="img/index/code-top.gif"
width=180></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=3 cellSpacing=0 width=776>
<TBODY>
<TR bgColor=#996633>
<TD colSpan=4 height=5></TD></TR>
<TR>
<TD align=middle bgColor=#eeeeee rowSpan=2 vAlign=top width=150>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD width=30><IMG height=22 src="img/index/l-1.gif"
width=30></TD>
<TD background="img/index/l-2.gif">撰稿人排行</TD>
<TD width=30><IMG height=22 src="img/index/l-3.gif"
width=45></TD></TR></TBODY></TABLE>
<TABLE bgColor=#000000 border=0 cellPadding=5 cellSpacing=1
width="100%"><TBODY>
<TR>
<TD bgColor=#eeeeee>
<%MasterMgr masterMgr = new MasterMgr();
c.removeAll(c);
c = masterMgr.getAllByTotalDesc();
iterator = c.iterator();
int i = 1;
while (iterator.hasNext()) {
Master master = (Master) iterator.next();
if (i > 5)
continue;
i++;
%> <%=i%>. <%=master.getUsername()%> 共<%=master.getTotal()%>篇新闻<BR>
<%}%>
</TD></TR></TBODY></TABLE></TD>
<TD align=middle rowSpan=2 vAlign=top>
<TABLE border=0 cellPadding=3 width="100%">
<TBODY>
<%String search = new String(request.getParameter("content").getBytes("ISO8859_1"),"UTF-8");
NewsMgr newsMgr = new NewsMgr();
c.removeAll(c);
c = newsMgr.searchNews(search);
iterator = c.iterator();
int j = 1;
if (c.size() == 0) {%>
<TR><TD width='50%'>没有你所要的记录</TD></TR>
<%}//结束if;
while (iterator.hasNext()) {
News news = (News) iterator.next();
if (j > 20)
continue;
j++; %>
<TR>
<TD width="50%">
<A href="news.jsp?id=<%=news.getId()%>"
target=_blank title=<%=news.getTopic()%>> <%if (news.getTopic().length() > 30)
out.println(news.getTopic().substring(0, 30) + "...");
else
out.println(news.getTopic());%></A>
</TD></TR><%}%></TBODY></TABLE>
</TD>
<TD align=middle bgColor=#996633 rowSpan=2 vAlign=top width=180>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=170>
<TBODY>
<TR>
<TD><IMG height=20 src="img/index/2002.gif" width=170></TD></TR>
<TR>
<TD bgColor=#333333>
<TABLE border=0 cellPadding=3 width="100%">
<TBODY>
<TR>
<TD><%Collection c2 = newsMgr.getAllByHitsDesc();
Iterator iterator2 = c2.iterator();
j = 1;
while (iterator2.hasNext()) {
News news = (News) iterator2.next();
if (j > 9)
continue;
j++;
%> <FONT color=#ffffff>■ <A class=w
href="news.jsp?id=<%=news.getId()%>" target=_blank
title=<%=news.getTopic()%>> <%if (news.getTopic().length() > 30)
out.println(news.getTopic().substring(0, 30) + "...");
else
out.println(news.getTopic());%></A></FONT><BR><FONT color=#ffffff>
<%}%> </FONT><BR></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD><IMG height=20 src="img/index/2001.gif"
width=170></TD></TR></TBODY></TABLE>
</TD></TR></TBODY></TABLE>
<TABLE bgColor=#eeeeee border=0 height=108 width=776>
<TBODY>
<TR>
<TD align=middle>
<%@ include file="foot.jsp"%>
</TD></TR></TBODY></TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -