⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 search.jsp

📁 JSP+ORACLE网站开发实例(下).rar
💻 JSP
字号:
<% String cuid= (String) session.getValue("cuid"); 
if((cuid==null)|(cuid=="")){
 
   out.print("<SCRIPT language=JavaScript>alert('操作超时,请重新登录!');");
   out.print("this.location.href='../default.jsp';</SCRIPT>"); 
    }
%>
<%@ include file="../conn.jsp"%>
<%! 
String replacenull(String a){ 
	if(a==null){
return ""; 
	}else{
return a; 
	}
} 
String selected(String a,String b){ 
	if(a==null){
    return ""; 
	}
	if(a.equals(b)){
return "selected"; 
	}else{
return ""; 
	}
} 
%> 
<%request.setCharacterEncoding("GB2312");
String key=request.getParameter("key");
 %>


<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../inc/index.css" type="text/css">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>天天人才—&gt;首页</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
<!--//
function check()
{
   if (isNaN(go2to.page.value))
		alert("请正确填写转到页数!");
   else if (go2to.page.value=="") 
	     {
		alert("请输入转到页数!");
		 }
   else
		go2to.submit();
}
//-->
</SCRIPT>
<SCRIPT language=JavaScript src="../inc/window.js"></SCRIPT>
<body topmargin="0" leftmargin="0">
<%@ include file="../inc/top3.jsp"%>
<div align="center" >
  <center>
  <table border="0" cellpadding="0" cellspacing="0" width="780" height="358" align="center">
    <tr>
      <td width="778" height="18" valign="top" colspan="5" bgcolor="#53BEB0"> 
          </td>
    </tr>
    <tr>
      <td width="139" valign="top" bgcolor="#53BEB0" height="176">   
        <div align="center">
          <table border="0" cellpadding="0" cellspacing="0" width="118" height="280">
            <tr>
              <td width="100%" height="163" background="../images/stat-bg.GIF" valign="top">
        <p align="center"><br>
        <a href="main.jsp">登录首页</a><br>
        <br>
		<a href="register.jsp">登录/更新公司资料</a><br>
        <br>
		<a href="publish.jsp">发布/更新招聘信息</a><br>
        <br>
        <a href="../changepwd.jsp?stype=company" target="_blank">修改登录密码</a><br>
        <br>
        <a href="search.jsp">全部人才列表</a>
              </td>
            </tr>
            <tr>
              <td width="100%" height="117" background="../images/stat-bg.GIF" valign="top">
        <p align="center"><br>
        <br>
        <a href="favorite.jsp">我的收藏夹<br>
        <br>
        <a href="mailbox.jsp">我的信箱</a><br>
        <br>
        <a href="../exit.jsp">退出登录</a>
              </td>
            </tr>
          </table>
        </div>
        <p align="center">&nbsp; </p>
        <p align="center"> 
      </td>
      <td width="24" height="284" valign="top"><img border="0" src="../images/selfk.GIF"></td>
  </center>
      
      <td width="480" height="284" valign="top">
            <%  int intPageSize;
int intRowCount;//记录总数
int intPageCount;//总页数
int intPage;//页面参数
String strPage;//定义变量用来传递page
int i,j;
intPageSize=5;//定义每页显示5条记录
strPage=request.getParameter("page");//取得当前的页码
if(strPage==null){//判断初始页面,如果没有显示记录,就置为第一页
intPage=1;
}else{
intPage=Integer.parseInt(strPage);//将strPage转化为整数
if(intPage<1) intPage=1;
}

String sqlname;
if(key!=null){
     sqlname="select count(id) from scott.person where job  like '%"+key+"%' or iname like '%"+key+"%' order by id desc" ;
}else{
sqlname="select count(id) from scott.person where job is not null order by id desc" ;
}
	 ResultSet rt=stmt.executeQuery(sqlname); 
rt.next();
intRowCount=rt.getInt(1);//取得整数保存与intRowCount变量中
intPageCount=(intRowCount+intPageSize-1)/intPageSize;//计算出总页数(记录总数+每页显示的记录-1)/每页显示的记录)
if(intPage>intPageCount)
intPage=intPageCount;
if(key!=null){
 sqlname="select * from scott.person where job  like '%"+key+"%' or iname like '%"+key+"%' order by id desc" ;
}else{
 sqlname="select * from scott.person  where job is not null order by id desc" ;
}

ResultSet rs=stmt.executeQuery(sqlname);//执行sql,按照时间先后排序显示
i=(intPage-1)*intPageSize;
   if(intRowCount==0){
	              out.print("<SCRIPT language=JavaScript>alert('对不起,没有符合搜索条件的记录!');");
              out.print("javascript:history.go(-1)</SCRIPT>");   
		  }else{  
		   %>
		   
		   
  
        <div align="left">
         <table border="1" cellpadding="0" cellspacing="0" width="465" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
          <tr>
          <td height="1" colspan="7" valign="bottom" width="461"><font color="#000000">&nbsp;</font></td> 
          </tr>
          <tr>
        
		 <td width="461" height="6" colspan="7" valign="bottom"><font color="#000000">&nbsp;</font>
	         共有[<font color="#ff0000"><%=intRowCount%></font>]条求职信息符合条件              
         </td>          
          <tr> 
		  <td width="461" height="6" colspan="7" valign="bottom">
		    <% for(j=0;j<i;j++)
rs.next();
%>
<%-- 设置intPage参数 --%>
			<FORM action=index.jsp method=POST>
<p align='center' vAlign='bottom'>
				第<%=intPage%>页 &nbsp;&nbsp;&nbsp;共<%=intPageCount%>页&nbsp;&nbsp;&nbsp;
				<%if(intPage<intPageCount){%>
				<a href="search.jsp?page=<%=intPage+1%>&key=<%=key%>">下一页</a>&nbsp;&nbsp;&nbsp;
				<%}%>
				<%if(intPage>1){%>
				<a href="search.jsp?page=<%=intPage-1%>&key=<%=key%>">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<%}%>
				 </form>        
				  <%}%>
		          
             </td>
         
		
           </tr>         
          <tr>
      <td height="3" valign="top" colspan="7" bgcolor="#000000" width="461">
      </td>
          </tr>
		  <tr>
          <td width="56" height="18" bgcolor="#EBEEF3" valign="bottom">&nbsp;姓名</td>
          <td width="36" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="center">性别</td>
          <td width="53" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="center">学历</td>
          <td width="161" height="18" bgcolor="#EBEEF3" valign="bottom">&nbsp;应聘职位</td>
          <td height="18" bgcolor="#EBEEF3" valign="bottom" width="77"><p align="center">发布日期</p></td>
          <td height="18" bgcolor="#EBEEF3" valign="bottom" width="36">
            <p align="center">发信</td>
          <td height="18" bgcolor="#EBEEF3" valign="bottom" width="30">
            <p align="center">收藏</td>
          </tr>
         <%
		i=0;
		while(i<intPageSize && rs.next()){
	%> 
          <tr>
          <td width="56" height="18" bgcolor="#EBEEF3" valign="bottom">&nbsp;<a href="javascript:openwin('../person.jsp?uid=<%=rs.getString("uname")%>','top=10,left=300,width=460,height=420')"><%=rs.getString("iname")%></a></td>
          <td width="36" height="18" bgcolor="#EBEEF3" valign="bottom"><p align="center">[<%=rs.getString("sex")%>]</p></td>
          <td width="53" height="18" bgcolor="#EBEEF3" valign="bottom"><p align="center">[<%=rs.getString("edu")%>]</p></td>
          <td width="161" height="18" bgcolor="#EBEEF3" valign="bottom">&nbsp;<%=rs.getString("job")%></td>
          <td width="77" height="18" bgcolor="#EBEEF3" valign="bottom"><p align="center">[<%=rs.getString("idate")%>]</p></td>
          <td width="36" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="center"><a href="javascript:openwin('sendmail.jsp?reid=<%=rs.getString("uname")%>','top=10,left=300,width=460,height=420')"><font face="Wingdings" color="#000000" size="2">*</font></a></td>
          <td width="30" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="center"><font face="Wingdings"><a href="addfav.jsp?fav=<%=rs.getString("uname")%>">1</a></font></td>
         <% i++;//通过I循环设置每页的页数
				} %>  
          <tr>
      <td height="3" valign="top" colspan="7" bgcolor="#000000" width="461">
      </td>
          </tr>
          <tr>
          <td width="461" height="8" valign="bottom" colspan="7">
            <form action="search.jsp" method=post>
            <p align="center"><br>
            <font color="#000000">
                职位搜索器: </font><INPUT           
                  maxLength=20 size=16 name="key" style="background-color: #EBEBEB; color: #00006A; font-family: 宋体; font-size: 9pt" value="请输入关键字-S" onclick="Javascript:this.value='';">&nbsp;        
            <input type="submit" value="搜 索" style="font-family: 宋体; font-size: 9pt; color: #00006A">
      </form>
      <br>
          </td>
          </tr>
		  </table>
          </div>
</td>
  <center>
      <td width="1" height="284" valign="top" bgcolor="#00006A"></td>
      <td width="126" height="284" valign="top" bgcolor="#F3F3F3"> </td>
    </tr>
    <tr>
      <td height="1" valign="top" colspan="5" bgcolor="#53BEB0" width="778"> 
        <p align="center"> </td>
    </tr>
  </center>
    </table>
  <table border="0" cellpadding="0" cellspacing="0" width="780" height="1">
    <tr>
      <td width="743" height="3" valign="top">
      <p align="center">
      </td>
    </tr>
    <tr>
      <td width="743" height="1" valign="top">
      <p align="center"><script language="javascript" src="../inc/copyright.js"></script>
      </td>
    </tr>
    <tr>
      <td width="743" height="3" valign="top">
      </td>
    </tr>
  </table>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -