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

📄 search.jsp

📁 JSP+ORACLE网站开发实例(下).rar
💻 JSP
字号:
<%@ include file="conn.jsp"%>
<%request.setCharacterEncoding("GB2312");
String key=request.getParameter("key");
String stype=request.getParameter("stype");
String gzdd=request.getParameter("gzdd");
String stype1="company" ;
String gzdd1="noxz" ;
if(key==null){
	key="";
}
 %>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
<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;人才市场—&gt;站内搜索</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
<!--//
function check()
{
   if (isNaN(go2to.page.value))
		alert("请正确填写转到页数!");
   else if (go2to.page.value=="") 
	     {
		alert("请输入转到页数!");
		 }
   else
		go2to.submit();
}
//-->
</SCRIPT>
<body topmargin="0" leftmargin="0">
<SCRIPT language=JavaScript src="inc/f-index.js"></SCRIPT>
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" height="358">
    <tr>
  </center>
      
      <td width="293" 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,sqlname1;
 

if(stype1.equals(stype)){
    if(gzdd1.equals(gzdd)){
     sqlname="select * from scott.company where job  like '%"+key+"%' or cname like '%"+key+"%' and job is not null  order by id desc" ;
    sqlname1="select count(id) from scott.company where job  like '%"+key+"%' or cname like '%"+key+"%' and job is not null  order by id desc" ;
				}else{
           sqlname="select * from scott.company where (job like '%"+key+"%' or cname like '%"+key+"%') and gzdd='"+gzdd+"' and job is not null order by id desc" ; 
		   sqlname1="select count(id) from scott.company where (job like '%"+key+"%' or cname like '%"+key+"%') and gzdd='"+gzdd+"' and job is not null order by id desc" ;
				}
} else{ 
			  if(gzdd1.equals(gzdd)){
              sqlname="select * from scott.person where job  like '%"+key+"%' or iname like '%"+key+"%' and job is not null  order by id desc" ;
			  sqlname1="select count(id) from scott.person where (job  like '%"+key+"%' or iname like '%"+key+"%') and job is not null  order by id desc" ;
              }else{ 
              sqlname="select * from scott.person where (job  like '%"+key+"%' or iname like '%"+key+"%') and gzdd='"+gzdd+"' and job is not null and gzdd='"+gzdd+"'order by id desc" ; 
			   sqlname1="select count(id) from scott.person where (job  like '%"+key+"%' or iname like '%"+key+"%') and gzdd='"+gzdd+"' and job is not null order by id desc" ;
              }
}
			 ResultSet rt=stmt.executeQuery(sqlname1); 
rt.next();
intRowCount=rt.getInt(1);//取得整数保存与intRowCount变量中
intPageCount=(intRowCount+intPageSize-1)/intPageSize;//计算出总页数(记录总数+每页显示的记录-1)/每页显示的记录)
if(intPage>intPageCount)
intPage=intPageCount;
i=(intPage-1)*intPageSize;
               ResultSet rs=stmt.executeQuery(sqlname);  
              
				 
	
             %>   
  
        <div align="left">
         <table border="1" cellpadding="0" cellspacing="0" width="430" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
          <tr>
          <td height="17" colspan="3" valign="bottom" width="426"></td> 
          </tr>
          <tr>
         
		 <td width="426" height="6" colspan="3" valign="bottom"><font color="#000000"></font><font color="#000000">
	
         共有[<font color="#ff0000"><%=intRowCount%></font>]条 页次:<font color="#0000AE"><%=intPage%></font>/<%=intPageCount%></td>           
          <tr> 
		  <td width="426" height="6" colspan="3" valign="bottom">
		  
		  <% for(j=0;j<i;j++)

%>
<%-- 设置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%>&stype=<%=stype%>&gzdd=<%=gzdd%>">下一页</a>&nbsp;&nbsp;&nbsp;
				<%}%>
				<%if(intPage>1){%>
				<a href="search.jsp?page=<%=intPage-1%>&key=<%=key%>&stype=<%=stype%>&gzdd=<%=gzdd%>">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<%}%>
				 </form>          
             </td>
           
           </tr>
           <% if(stype1.equals(stype)){%>
          <tr>
      <td height="3" valign="top" colspan="3" bgcolor="#000000">
      </td>
          </tr>
		  <tr>
          <td width="174" height="18" bgcolor="#EBEEF3" valign="bottom">&nbsp;公司名称</td>
          <td width="174" height="18" bgcolor="#EBEEF3" valign="bottom">&nbsp;招聘职位</td>
          <td height="18" bgcolor="#EBEEF3" valign="bottom" width="75"><p align="center">发布日期</p></td>
          </tr>
           <%
		 i=0;
		while(i<intPageSize&&rs.next()){
	%>
          <tr>
          <td width="174" height="18" bgcolor="#EBEEF3" valign="bottom">&nbsp;<a href="javascript:openwin('company.jsp?uid=<%=rs.getString("uname")%>','top=10,left=80,width=460,height=420')"><%=rs.getString("cname")%></a></td>
          <td width="174" height="18" bgcolor="#EBEEF3" valign="bottom">&nbsp;<a href="javascript:openwin('job.jsp?uid=<%=rs.getString("uname")%>','top=10,left=80,width=460,height=420')"><%=rs.getString("job")%></a></td>
          <td width="74" height="18" bgcolor="#EBEEF3" valign="bottom"><p align="center"><%=rs.getString("idate")%></p></td>
          </tr>
		 <% i++;//通过I循环设置每页的页数
				} %>
          <tr>
      <td height="3" valign="top" colspan="3" bgcolor="#000000">
      </td>
          </tr>
          <tr>
          <td width="422" height="8" valign="bottom" colspan="3">
            <p align="center"><br>
            【<a href="javascript:window.close()">关闭窗口</a>】</td>
          </tr>
		  </table>
          </div>
		  <% }else{ %>
           <div align="left">
		  <table border="1" cellpadding="0" cellspacing="0" width="430" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
        <tr>
      <td height="3" valign="top" colspan="5" bgcolor="#000000">
      </td>
        </tr>
        <tr>
          <td width="67" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="left">&nbsp;姓名</p>   
          </td>
          <td width="45" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="center">性 别</p>  
          </td>
          <td width="56" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="center">学 历   
          </td>
          <td width="178" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="left">&nbsp;应聘职位</td>
  <center>
          <td width="75" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="center">登录日期</p>
  </td>
        </tr>
                  <%
		i=0;
		while(i<intPageSize&&rs.next()){
	%>
        </center>
        <tr>
          <td width="64" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="left">&nbsp;<a href="javascript:openwin('person.jsp?uid=<%=rs.getString("uname")%>','top=10,left=80,width=460,height=420')"><%=rs.getString("iname")%></a></p>
          </td>
          <td width="48" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="center">[<%=rs.getString("sex")%>]</p>
          </td>
          <center>
          <td width="55" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="center">[<%=rs.getString("edu")%>]</td>
          <td width="179" height="18" bgcolor="#EBEEF3" valign="bottom">&nbsp;<%=rs.getString("job")%></td>
          <td width="72" height="18" bgcolor="#EBEEF3" valign="bottom">
            <p align="center"><%=rs.getString("idate")%></p>
          </td>
        </tr>
        <% i++;//通过I循环设置每页的页数
				} %>
          <tr>
      <td height="3" valign="top" colspan="5" bgcolor="#000000">
      </td>
          </tr>
          <tr>
          <td width="418" height="7" valign="bottom" colspan="5">
            <p align="center"><br>
            【<a href="javascript:window.close()">关闭窗口</a>】
          </td>
          </tr>
		 </table>
        </center>
        </div>
		<% } %>
      </td>
  <center>
    </tr>
  </center>
    </table>
</body>
</html>

⌨️ 快捷键说明

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