📄 searchresult.jsp
字号:
<%@page language="java" contentType="text/html;charset=GBK"%>
<%@page import="java.util.*,java.text.*"%>
<%
oa.bean.PersonBean myBean = null;
oa.bean.OrgMenuBean orgmenuBean = null;
oa.bean.ArticleBean articleBean = null;
try{
myBean = new oa.bean.PersonBean();
orgmenuBean = new oa.bean.OrgMenuBean();
articleBean = new oa.bean.ArticleBean();
if ( myBean.getConn() == null
|| orgmenuBean.getConn() == null
|| articleBean.getConn() == null )
{
%>
数据库无法响应,请<a href="javascript:window.history.back(-1);">返回</a>重试
<%out.close();
}
oa.main.DealString ds = new oa.main.DealString();
String srchObject = ds.toGBK((String)request.getParameter("keyword"));
if(srchObject==null) srchObject="";
String title_kw = ds.toString((String)request.getParameter("title_kw"));
String time = ds.toString((String)request.getParameter("time"));
String uid = (String)session.getAttribute("zgbh");
myBean.setPersonNO(uid.trim());
String bmbh = myBean.getBMBH();
String name = myBean.getFatherName(bmbh);//strOrgNO
String strOrgNO = myBean.getOrgNO();
if(name.equals(""))
name = myBean.getPsBmName();
else
name = name.substring(0,name.length()-1);
String lx = ds.toGBK(ds.toString(request.getParameter("lx")));
String only = ds.toString(request.getParameter("only"));
String bm = (String)request.getParameter("bm");
if(bm==null) bm = "1";
if(bm.equals(""))bm = "1";
int cur = Integer.parseInt(bm);
int sum = 1;
//分辨率
String w = ds.toString((String)session.getAttribute("SCREEN"));
int rows = 800;
if(!w.equals(""))rows = Integer.parseInt(w);
int wlen=(rows-200)/16-3;
rows = rows - 600;
rows = rows/40;
Vector v111 = orgmenuBean.getOnePage("select bh from orgmenu where mc='"+lx+"' and bmbh='"+strOrgNO+"'",1,1);
String strID1 = (String)((Hashtable)v111.get(1)).get("BH");
orgmenuBean.setID(Integer.parseInt(strID1));
String flx = orgmenuBean.getID1();//取得一级类别名称
Vector vetmenu2 = new Vector();
Hashtable hash1 = new Hashtable();
if(!only.equals("1")){
vetmenu2 = (Vector)orgmenuBean.getDownCs(strID1); //取得下一级类信息
}
hash1.put("BH",strID1);
if(vetmenu2.size()==0){
hash1.put("MC",lx);
wlen = wlen * 2;
}
else
hash1.put("MC","其他");
vetmenu2.add(hash1);
int jmenu2=vetmenu2.size();
int jnum=jmenu2; //新闻显示行数
int intnumconf = 10;
int more = 0;
boolean resultY = false;
%>
<html>
<head>
<title>个人主页</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css/my_new.css" type="text/css">
</head>
<body class="bgl" bgcolor="#F7F7F7">
<table width="100%" border="0" cellspacing="0" cellpadding="0" valign=top>
<tr width="100%">
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="2969B5">
<td width="12" height="22"><img src="../image/index/connerx1.gif" width="12" height="22"></td>
<td height="22"><img src="../image/index/alert_2.gif" width="17" height="22"></td>
<td width="40%" height="22"><q style="font-size:10pt;color:#ffffff;cursor:hand;" onclick="javascript:parent.right.location='my_newslist.jsp?lx=<%=lx%>'"><%=lx%>(<%=name%>)</q></td>
<td width="50%" height="22" align="right" colSpan="2"><input size="12" name="keyword" onkeydown="if(window.event.keyCode==13)search();" onmouseover="this.focus();" onfocus="this.select();">
<!--select name="s1">
<option value="1" selected>标题</option>
<option value="2">关键字</option>
</select-->
<select name="s2">
<option value="all" selected>所有时间</option>
<option value="1">昨天以来</option>
<option value="3">3 天以来</option>
<option value="7">7 天以来</option>
<option value="15">15天以来</option>
<option value="30">30天以来</option>
<option value="60">60天以来</option>
<option value="90">90天以来</option>
</select>
<input type="button" value="搜索" onclick="search();"></td>
<td width="15%" height="22" align=right></td>
<td width="12" height="22">
<div align="right"><img src="../image/index/connerx2.gif" width="12" height="22"></div>
</td>
</tr>
</table>
</td>
</tr>
<tr width="100%" valign=top>
<td width="100%" valign=top>
<table cellSpacing="0" cellPadding="0" width="97%" border="0">
<tbody>
<tr>
<td width="16" height="20"><img height="9" src="../images/a3.gif" width="9"></td>
<td height="40" align=left>
<strong>您搜索的关键字:<font color=red><b><%=srchObject%></b></font></strong><font color="#CCCCCC"> </font>
</td>
</tr>
<tr bgColor="#cccccc">
<td colSpan="2" height="1" width="100%"></td>
</tr>
<tr>
<td colSpan="2" height="1" width="100%"></td>
</tr>
<tr bgColor="#cccccc">
<td colSpan="2" height="1" width="100%"></td>
</tr>
</tbody>
</table>
<table cellSpacing="0" cellPadding="0" width="100%" border="0" height="91" >
<tbody>
<tr>
<td height="40"><ul>
<%
String strsql = " and (article.wzlx="+(String)((Hashtable)vetmenu2.get(0)).get("BH")+" ";
for(int kl=1;kl<jnum;kl++)//jnum:子类类型数
{
strsql = strsql + " or article.wzlx="+(String)((Hashtable)vetmenu2.get(kl)).get("BH")+" ";
}
strsql = strsql + " ) ";
//strsql="";
//取得文章信息
Vector vetmu1 = (Vector)articleBean.getOrgNews(strsql,srchObject,title_kw,time,cur,20);
int jmu1=vetmu1.size();
if(jmu1 != 1)//搜索的新闻条数为零
{
sum = Integer.parseInt((String)vetmu1.get(0));
%>
<!--TABLE cellSpacing=0 cellPadding=0 width="98%" border=0 valign=top>
<TBODY>
<TR><%//if(jmenu2==1){%>
<TD class=c vAlign=top width="95%">
<%//}else{%>
<TD class=c vAlign=top width="48%"><%//}%>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width=15 height=20><IMG height=9 src="oa/images/a3.gif" width=9></TD>
<TD width=75><STRONG><FONT class=f_title><%//=(String)((Hashtable)vetmenu2.get(kl)).get("MC")%></FONT></STRONG></TD>
<TD><IMG height=20 src="oa/images/line.gif" width=150></TD></TR>
<TR class=bgline1>
<TD colSpan=3 height=1></TD></TR>
<TR>
<TD colSpan=3 height=5 style="LINE-HEIGHT: 130%"></TD></TR></TBODY></TABLE-->
<%
String strmu1Id [] = new String[jmu1];
String strmu1title[] = new String[jmu1];//存放文章标题
String strmu1time[] = new String[jmu1];//发表时间
String strmu1Hits[] = new String[jmu1];//取得鼠标提示信息
String strmenu[] = new String[jmu1];//信息类名称
for(int is=1;is<vetmu1.size();is++)
{
Hashtable hash = (Hashtable)vetmu1.get(is);
strmu1Id[is] = (String)hash.get("ID");
strmu1title[is] = (String)hash.get("TITLE");
if(title_kw.equals("1"))
{
String tempstr[] = ds.splitStr(srchObject,' ');
for(int n=0;n<tempstr.length;n++)
{
strmu1title[is] = strmu1title[is].replaceAll(tempstr[n],"<font color=red>"+tempstr[n]+"</font>");
}
}
strmu1time[is] = ((String)hash.get("ADDTIME")).substring(0,10);
strmu1Hits[is] = ((String)hash.get("HITS"));
strmenu[is] = ((String)hash.get("MC"));
}
%>
<%if(jmenu2!=1&&jmu1>intnumconf){ jmu1=intnumconf; more = 1;}%>
<%for(int kls=1;kls<vetmu1.size();kls++)
{%><li><a onclick="view('<%=strmu1Id[kls]%>');" style="cursor:hand;LINE-HEIGHT: 150%" target=_blank title=<%=strmu1Hits[kls]%>><%=strmu1title[kls]%> ( <%=strmu1time[kls]%> )</a> 【<%=strmenu[kls]%>】<br><%}%>
<!--/TD>
<TD width=30></TD>
</TR>
</TBODY>
</TABLE-->
<%
}
else
{
%> <center><br><font color=red>没有搜索到任何结果!</font><br><br></center>
<% }%>
</ul></td>
</tr>
</tbody>
</table>
</td>
</tr>
<TR>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="2969B5">
<td width="12" height="22"><img src="../image/index/connerx3.gif" width="12" height="22"></td>
<TD align=right bgColor=#2969B5 height=22> <%if(vetmu1.size()>1){%>
<%
for(int j = 1 ; j <= sum ; j++)
{
String go = "searchResult.jsp?keyword="+srchObject+"&title_kw="+title_kw+"&time="+time+"&lx="+lx+"&only="+only+"&bm="+j;
if(j==cur)
{
%>
<font color="#ffffff"><%=j%></font>
<%
}
else
{
%><font color="#ffffff">[<a href="<%=go%>"><font color="#ffffff"><%=j%></font></a>]</font>
<%}}
%>
<font color="#ffffff"> 当前<%=cur%>/<%=sum%>页
<%if(sum>1){%>直接<input type=image src="oa/images/hand.gif" name="gotof" onclick="return checkdata();">
<input type=text size=2 name=bm class=formcolor>页<%}%></font><%
}else{%> <%}%></TD>
<td width="12" height="22">
<div align="right"><img src="../image/index/connerx4.gif" width="12" height="22"></div>
</td>
</tr>
</table>
</TR>
</table>
<script>
function isDigit(str)
{
var bool = true;
for(var i=0;i<str.length;i++)
{
if(!(str.charAt(i)>=0&&str.charAt(i)<=9))
{
bool = false;
break;
}
}
return bool;
}
function checkdata()
{
if(!isDigit(document.all.bm.value))
{
alert("输入的页码不是数字!");
document.all.bm.value="";
return false;
}
if(document.all.bm.value=="")
{
alert("请输入页码!");
document.all.bm.value="";
return false;
}
else
{
var t = document.all.bm.value;
var cur = "<%=cur%>";
var sum = "<%=sum%>";
while(t.length>cur.length)
{
alert("请跳至1和"+sum+"之间!");
document.all.bm.value="";
return false;
}
if(t==cur){return false;}
while(t.length>sum.length)
{
alert("请跳至1和"+sum+"之间!");
document.all.bm.value="";
return false;
}
if(t<1||t>sum)
{
alert("请跳至1和"+sum+"之间!");
document.all.bm.value="";
return false;
}
}
window.parent.right.location = "searchResult.jsp?keyword=<%=srchObject%>&title_kw=<%=title_kw%>&time=<%=time%>&lx=<%=lx%>&only=<%=only%>&bm="+document.all.bm.value;
}
function gotopage(id)
{
window.parent.right.location = "my_newslist.jsp?bm="+id+"&lx=<%=lx%>&only=1";
}
function view(id)
{
window.parent.right.location = "my_newsread.jsp?id="+id+"&lx=<%=lx%>";
}
function changemenu2(type)
{
if(type!="其他")
window.parent.right.location = "my_newslist.jsp?lx="+type+"&only=1";
else
window.parent.right.location = "my_newslist.jsp?lx=<%=lx%>"+"&only=1";
}
function search()
{
//window.location = "searchResult.jsp?keyword="+document.all.keyword.value;
}
function search()
{//按标题搜索
window.location = "searchResult.jsp?keyword="+document.all.keyword.value+"&title_kw=1&time="+document.all.s2.value+"&lx=<%=lx%>&only=stronly";
}
</script>
</body>
</html>
<%
}finally{
myBean.closeConn();
articleBean.closeConn();
orgmenuBean.closeConn();
}%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -