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

📄 search.jsp

📁 本程序的功能如下: 1)本程序完全采用jsp脚本技术 2)后台管理
💻 JSP
字号:
<%@ page pageEncoding="gb2312" language="java" import="java.sql.*" errorPage="err.jsp?msg=对不起,没有找到你所需要的数据!" %>
<%@ include file="conn.jsp"%>
<%request.setCharacterEncoding("gb2312");
 response.setContentType("text/html;charset=GB2312"); 
String keywords=request.getParameter("k").trim();
//keywords=keywords.getBytes("gb2312");
String sql="select num=count(*) from download where softname like '%"+keywords+"%' or note like '%"+keywords+"%'";
ResultSet rs=stmt.executeQuery(sql);
//out.print(sql);
rs.next();
int intRowCount;
intRowCount=rs.getInt("num");
//out.print(intRowCount);
if(intRowCount==0){
//keywords=new String(keywords.getBytes("gb2312"),"UTF-8");
String gourl="http://www.baidu.com/baidu?ct=0&ie=gb2312&bs=%B3%C7%CA%D0&wd="+keywords+"&cl=3&f=8";
//out.print(gourl);
response.sendRedirect(gourl);
}else{
//request.setCharacterEncoding("gb2312");
Statement stmt2=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql2="select * from class";
ResultSet rs2=stmt2.executeQuery(sql2);
int intPageCount;//初始页数
int intPageSize;//初始页面大小
//int intRowCount;//初始记录数
int intPage;//初始页号
int i,j;
String pageno=request.getParameter("page");
if(pageno==null){
intPage=1;
 }else{
  intPage=Integer.parseInt(pageno);
  if(intPage<1){
  intPage=1;
  }
 }
intPageSize=20;
intPageCount=(intRowCount+intPageSize-1) / intPageSize;

if(intPage>intPageCount)
{ intPage=intPageCount;}
 
Statement stmt4=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql4="select a.id,a.softname,a.downurl,a.urlsay,a.softsize,a.codeshow,a.abouturl,a.images,a.sq,a.lang,a.tj,a.jp,a.jb,a.note,a.hits,a.yxhj,a.grade,a.addtime,classid=a.classid,class=b.class from download as a inner join class as b on a.classid=b.classid where a.softname like '%"+keywords+"%' or a.note like '%"+keywords+"%' order by a.addtime Desc";
ResultSet rs4=stmt4.executeQuery(sql4);
//out.print(intPage);
i=(intPage-1)*intPageSize;
for(j=0;j<i;j++)
{rs4.next();
//out.print(i);
//out.print("<br>");
}

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>南京同庆源码站 >>> 为广大站长提供最新最全的建站资源!</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META http-equiv=Content-Language content=zh-cn>
<META 
content=站长,站长资源,闪讯,im63,im63.com,asp源码,cgi源码,php源码,jsp源码,.net源码,网站素材,网页素材,网页模板,韩国模板,欧美模板,商业模板,免费模板,常用软件,注册版,破解版,免费LOGO,娱乐,flash动画,网络编程,网络学院,站长资源,网站联盟,精品网址,图片,壁纸,桌面,书籍教程,asp编程,cgi编程,php编程,平面设计,多媒体设计,服务器架设,服务器软件,电子图书,LOGO模板,PNG源文件,PSD源文件,精品字体,字体下载,软件下载 
name=keywords><LINK href="images/style.css" 
rel=stylesheet>
<META content="MSHTML 6.00.2800.1458" name=GENERATOR></HEAD>
<BODY>
<CENTER>
<SCRIPT language=javascript 
src="images/head.js"></SCRIPT>

<TABLE cellSpacing=0 cellPadding=0 width=770 bgColor=#ffffff border=0>
  <TBODY>
  <TR>
    <TD width=770 height=4></TD></TR></TBODY></TABLE>
<TABLE height=24 cellSpacing=1 cellPadding=0 width=770 bgColor=#eeeeee 
  border=0><TBODY>
  <TR>
    <TD width="100%" bgColor=#f4f4f4><IMG height=1 
      src="images/c.gif" width=4 
      border=0>您的位置:<A href="index.jsp">首页</A> &gt;&gt;搜索</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=770 border=0>
  <TBODY>
  <TR>
    <TD width="100%" height=4></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=770 border=0>
  <TBODY>
  <TR>
    <TD vAlign=top width=2 bgColor=#f7f7f7><IMG height=1 
      src="images/c.gif" width=2 border=0> </TD>
    <TD vAlign=top bgColor=#f7f7f7>
      <TABLE cellSpacing=0 cellPadding=0 width=190 border=0>
        <TBODY>
        <TR>
          <TD width="100%">
            <TABLE cellSpacing=0 cellPadding=2 width=188 border=0>
              <TBODY>
              <TR>
                <TD width=188 
                background="images/left_bg.gif" 
                height=30>&nbsp;&nbsp;&nbsp;&nbsp;<B><FONT color=#ffffff><SPAN 
                  style="LETTER-SPACING: 1pt">分类列表</SPAN></FONT></B></TD></TR>
              <TR>
                <TD align=middle width="100%" height=4></TD></TR>
              <TR>
                <TD align=right width="100%">
                  <TABLE cellSpacing=0 cellPadding=0 width=140 border=0>
                    <TBODY>
					<%//if (rs.next()){
					while(rs2.next()){
					%>
                    <TR>
                      <TD align=middle width=20><IMG 
                        src="images/2.gif" 
                        border=0></TD>
                      <TD width=120><A 
                        href="sort.jsp?sortid=<%=rs2.getString("classid")%>"><%=rs2.getString("class")%></A></TD></TR>
						<%
						}
						rs2.close();
						stmt2.close();
						//}else{
						//out.print("暂无分类!");
						//}%>
                    </TBODY></TABLE></TD></TR>
              <TR>
                <TD align=middle width="100%" height=2></TD></TR></TBODY></TABLE>
            </TD></TR></TBODY></TABLE></TD>
    <TD width=4><IMG height=1 
      src="images/c.gif" width=4 border=0></TD>
    <TD vAlign=top width=572>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD width="100%" height=3>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 bgcolor="#FFFFFF">
              <TBODY>
              <TR>
                <TD class=menu align=middle width="50%" bgColor=#3faee4 
                height=24><B>软件名称</B></TD>
                <TD class=menu align=middle width="15%" bgColor=#3faee4 
                height=24><B>更新时间</B></TD>
                <TD class=menu align=middle width="15%" bgColor=#3faee4 
                height=24><B>软件等级</B></TD>
                <TD class=menu align=middle width="10%" bgColor=#3faee4 
                height=24><B>人气</B></TD>
                <TD class=menu align=middle width="10%" bgColor=#3faee4 
                height=24><B>大小</B></TD></TR>
              <TR>
                <TD width="100%" colSpan=5 height=6>
				<% 
				 i=0;
				 while((i<intPageSize)&&rs4.next()){
				 //String classid=rs4.getString("classid");
				 if ((rs4.getString("softname")).length()>28){
				 String name=rs4.getString("softname").substring(0,28);
				 }else{
				 String name=rs4.getString("softname");
				 }
				 String note=rs4.getString("note");
				 if(note.length()>50){
				 note=note.substring(0,50)+"……";
				 }
				%>
                  <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD width="50%" height=22>·<A 
                        href="soft.jsp?softid=<%=rs4.getString("id")%>" 
                        target=_blank><B><%=rs4.getString("softname").substring(0)%> 
                        </B></A></TD>
                      <TD align=middle width="15%" height=22><%=rs4.getDate("addtime")%></TD>
                      <TD align=middle width="15%" height=22>
					  <%j=rs4.getInt("grade");
					  while(j>0){%><IMG src="images/d_star.gif" border=0><%
						j--;
						}
						%></TD>
                      <TD align=middle width="10%" height=22><%=rs4.getString("hits")%></TD>
                      <TD align=middle width="10%" height=22><%=rs4.getString("softsize")%></TD></TR>
                    <TR>
                      <TD width="100%" colSpan=5>&nbsp;&nbsp;<%=note%><BR><IMG 
                        height=4 
                        src="images/c.gif" 
                        width=1 border=0><BR><FONT color=#666666>软件类别:<FONT 
                        color=#666666><%=rs4.getString("jb")%></FONT>&nbsp; 
                        运行环境:<%=rs4.getString("yxhj")%></FONT></TD></TR>
                    <TR>
                      <TD width="100%" colSpan=5 height=3></TD></TR>
                    <TR>
                      <TD width="100%" 
                      background="images/bg_dot.gif" 
                      colSpan=5 height=1></TD></TR>
                    <TR>
                      <TD width="100%" colSpan=5 height=3></TD></TR></TBODY></TABLE>
					  <%
					  i++;
					  }
					  %>
                 </TBODY></TABLE>
                  
                 
                    
                    <TR>
                      <TD width="100%" colSpan=5 height=3 bgcolor="#FFFFFF"></TD></TR></TBODY></TABLE>
                  <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 bgcolor="#FFFFFF">
                    <TBODY>
                    <TR>
                      <TD>页次:<B><%=intPage%></B>/<B><%=intPageCount%></B> 每页<B><%=intPageSize%></B> 本类软件<B><%=intRowCount%></B>个</TD>
                      <TD width="50%" align="center">
					  <%//if (intPage!=1){%>
                       	<A 
                        href="search.jsp?k=<%=keywords%>&page=1"><FONT  face=Webdings>9</FONT></A><A  href="search.jsp?k=<%=keywords%>&page=<%=(intPage-1)%>"><FONT  face=Webdings>7</FONT></A>&nbsp;
						<%//}
						j=intPageCount;
						if(j>5) j=5;
						for(i=1;i<=j;i++){
						%>
						<A 
                        href="search.jsp?k=<%=keywords%>&page=<%=(i)%>">[<%=i%>]</A>
						 <%
						 }
						 //if (intPage!=intPageCount){%>&nbsp;
						<A 
                        title=下一页 
                        href="search.jsp?k=<%=keywords%>&page=<%=(intPage+1)%>"><FONT 
                        face=Webdings>8</FONT></A><A title=最后页 
                        href="search.jsp?k=<%=keywords%>&page=<%=intPageCount%>"><FONT 
                        face=Webdings>:</FONT></A>
						<%//}%></TD>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0>
                          <FORM  method="post">
                          <TBODY>
                          <TR>
                            <TD>转到第<SELECT 
                              onchange="javascript:goUrl(this.options[this.selectedIndex].value);"  name=select>
							  <% for (i=1;i<=j;i++){%>
							  <OPTION value=<%=i%> <%if(intPage==i)out.print("selected");%>><%=i%></OPTION>
								<%}%>
								</SELECT>页
                                </TD></TR></TBODY>
                                </FORM>
                                
                                </TABLE>
                                </TD></TR>
                                </TBODY></TABLE>
                                </TD></TR>
                                </TBODY>
                                </TABLE>
                                </TD></TR>
                                </TBODY></TABLE></TD>
    <TD vAlign=top width=4><IMG height=1 
      src="images/c.gif" width=4 
  border=0></TD></TR></TBODY>
  </TABLE>
  <script language="javascript">
  function goUrl(page)
  {
  window.location.href="search.jsp?k=<%=keywords%>page="+page;
  
  }  
  </script>
<SCRIPT language=javascript 
src="images/foot.js"></SCRIPT>
</CENTER>
<TABLE id=AutoNumber1 style="BORDER-COLLAPSE: collapse" borderColor=#111111 
cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD width="100%"></TD></TR></TBODY></TABLE></BODY></HTML>
<%
rs4.close();
stmt4.close();
conn.close();
}
rs.close();
stmt.close();
%>

⌨️ 快捷键说明

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