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

📄 sort.jsp

📁 JSP+ORACLE网站开发实例(下).rar
💻 JSP
字号:
<%@ include file="conn.jsp"%>
<%! 
String replacenull(String a){ 
	if(a==null){
return "&nbsp;"; 
	}else{
return a; 
	}
} 
%> 
<% request.setCharacterEncoding("GB2312");
String  sqlname="";
String  classname="";
String  Nclassname="";
sqlname="select class from scott.class where classid ='"+request.getParameter("classid")+"'";
ResultSet rt=stmt.executeQuery(sqlname); 
		if(rt.next()){
		classname=rt.getString("class");
		}
		rt.close();
		if(request.getParameter("Nclassid")!=null){
		sqlname="select Nclass.Nclass,class.class from scott.Nclass,scott.class where Nclass.classid=class.classid and Nclass.Nclassid='"+request.getParameter("Nclassid")+"'";
		rt=stmt.executeQuery(sqlname); 
		if(rt.next()){
		classname=rt.getString("class");
		Nclassname=rt.getString("Nclass");
		}
		rt.close();
		}
%>
<HTML><HEAD><TITLE>
<%=classname%>
<%if(request.getParameter("Nclassid")!=null){%>
:<%=Nclassname%>
<%}%></TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<link rel="stylesheet" href="images/style.css">

<SCRIPT language=javascript>
function popwin2(id,path)
{		window.open("openarticle.jsp?id="+id+"&ppath="+path,"");
}
</SCRIPT>
</HEAD>
<%@ include file="topMain.jsp"%>
<table width="752" border="0" cellpadding="0" cellspacing="1" align="center" bgcolor="#999966">
  <tr> 
    <td valign="top" bgcolor="#E8F0F8"> 
      <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#999966" height="40">
        <form method="post" name="myform" action="search.jsp">
          <tr> 
            <td bgcolor="#E8F0F8" valign="middle" align="center"> 搜索: 
              <input type="text" name="keyword" class=textfield size=10  maxlength="50"  style="font-family: Arial">
              <input type="submit" name="Submit22" value="搜索" style="height='21'" class="botton">
            </td>
          </tr>
        </form>
      </table>
      <table border=0 cellpadding=0 width=100% align="center" bgcolor="#999966" cellspacing=0>
        <tr> 
          <td height="20" bgcolor="#999966"> 
            <div align="center"><a class=white href='sort.jsp?classid=<%=request.getParameter("classid")%>'><font color="#FFFFFF"><%=classname%></font></a></div>
          </td>
        </tr>
        <tr align=middle bgcolor="#999999"> 
          <td bgcolor="#999999" valign="top"> 
            <table border=0 cellpadding=0 cellspacing=0 width=100% height="100" align="center">
              <tr> 
                <td bgcolor=#E8F0F8         
                  valign=top width="191"><font style=line-height:150%> 
                  <% if(request.getParameter("classid")==null){     
			sqlname="select Nclass,Nclassid from scott.Nclass where classid = 1";    
	  	}else{   
			sqlname="select Nclass,Nclassid from scott.Nclass where classid='"+request.getParameter("classid")+"'";        
	}     
	rs=stmt.executeQuery(sqlname); %>
                  </font> 
                  <table width="100%" border="0" cellspacing="0">
                    <%while(rs.next()){%>
                    <tr> 
                      <td align="right" height="21"><img src="images/into.gif"></td>
                      <td align="left" height="21"> 
                      <a href="sort.jsp?classid=<%=request.getParameter("classid")%>&Nclassid=<%=rs.getString("Nclassid")%>"><%=rs.getString("Nclass")%></a> 
                      </td>
                    </tr>
                    <%}       
  rs.close();        
   %>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
      <table border="0" width="100%" cellspacing="0" cellpadding="0">
        <tr> 
          <td height="20" bgcolor="#999966"> 
            <p align="center"><font color=#ffffff>本类热门下载</font> 
          </td>
        </tr>
        <tr> 
          <td width="100%" bgcolor="#999999"> 
            <table border="0" width="100%" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="20" bgcolor="#E8F0F8" width="4%"></td>
                <td width="96%" bgcolor="#E8F0F8" height="100" valign="top"> 
                  <%if(request.getParameter("Nclassid")==null){     
			sqlname="select id,showname,bb from scott.download where classid ='"+request.getParameter("classid")+"' order by download.id desc";    
				}else{
			sqlname="select id,showname,bb from scott.download where Nclassid ='"+request.getParameter("Nclassid")+"' order by download.id desc";    
	            }                 
	rs=stmt.executeQuery(sqlname);                 
	int i=0;
		while(i<10 && rs.next()){
   out.print("<li><A href=list.jsp?id="+rs.getString("id")+">"+rs.getString("showname")+" "+replacenull(rs.getString("bb"))+"</A></li>");
	}                                    
	rs.close();                                     
%>
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr> 
          <td width="180" height="100%" bgcolor="#E8F0F8"></td>
        </tr>
      </table>
    </td>
    <td width="76%" valign="top" bgcolor="#FFFFFF"> 
      <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td height="5"></td>
        </tr>
        <tr>
          <td background="images/bj4.gif" height="1"><img src="images/spacer.gif" width="1" height="1"></td>
        </tr>
      </table>
      <table width="98%" border="0" align="center">
        <tr> 
          <td bgcolor="#efefef">您的位置:<a href="index.jsp">首页</a> >> <a href="sort.jsp?classid=<%=request.getParameter("classid")%>"><%=classname%></a> 
            >> <%=Nclassname%></td>
        </tr>
      </table>
      
      <table border=0 cellpadding=0 cellspacing=2 width=100%>
        <tbody> 
        <tr> 
          <td valign=top width=582> 
            <%    int intPageSize;
int intRowCount;//记录总数
int intPageCount;//总页数
int intPage;//页面参数
String strPage;//定义变量用来传递page
int j;
intPageSize=10;//定义每页显示10条记录
strPage=request.getParameter("page");//取得当前的页码
if(strPage==null){//判断初始页面,如果没有显示记录,就置为第一页
intPage=1;
}else{
intPage=Integer.parseInt(strPage);//将strPage转化为整数
if(intPage<1) intPage=1;
}
if(request.getParameter("Nclassid")==null){     
			sqlname="select count(id) from scott.download where classid ='"+request.getParameter("classid")+"' order by download.id desc";    
				}else{
			sqlname="select count(id) from scott.download where Nclassid ='"+request.getParameter("Nclassid")+"' order by download.id desc";    
	            }   
rt=stmt.executeQuery(sqlname); 
			rt.next();
intRowCount=rt.getInt(1);//取得整数保存与intRowCount变量中
intPageCount=(intRowCount+intPageSize-1)/intPageSize;//计算出总页数(记录总数+每页显示的记录-1)/每页显示的记录)
if(intPage>intPageCount)
intPage=intPageCount;
			if(request.getParameter("Nclassid")==null){     
			sqlname="select * from scott.download where classid ='"+request.getParameter("classid")+"' order by download.id desc";    
				}else{
			sqlname="select * from scott.download where Nclassid ='"+request.getParameter("Nclassid")+"' order by download.id desc";    
	            }      
rs=stmt.executeQuery(sqlname);  
i=(intPage-1)*intPageSize;
for(j=0;j<i;j++)
rs.next();

  if(intRowCount==0){                      
       		out.print("<table border=0 width=100% height=100 cellpadding=0><tr><td width='100%'><p align=center>没有或没有找到任何信息</td></tr></table>" );                          
   	}else{                           
  %>  
            <table width="98%" >
              <tr>
                <td  width="100%" > 
                  <table border="0" cellspacing="1" cellpadding="0" width="98%" align="center" bgcolor="#3399ff">
              
                    <tr> 
                      <td width="37%" align="right" height="22" background="images/bg.gif"> 
                        <div align="center"><font color="#000000"><b>影片名称:</b></font></div>
                      </td>
                      <td width="11%" align="right" height="22" bgcolor="#E8F0F8"> 
                        <div align="center"><font color="#000000">影片性质</font></div>
                      </td>
                      <td width="12%" align=center height="22" bgcolor="#E8F0F8"><a href="sort.jsp?classid=<%=request.getParameter("classid")%>&Nclassid=<%=request.getParameter("Nclassid")%>&order=dateandtime" title="点击按降序排列"><font color="#000000">整理日期</font></a></td>
                      <td width="11%" align=center height="22" bgcolor="#E8F0F8"><a href="sort.jsp?classid=<%=request.getParameter("classid")%>&Nclassid=<%=request.getParameter("Nclassid")%>&order=hits"  title="点击按降序排列"><font color="#000000">下载次数</font></a></td>
                      <td width="11%" align=center height="22" bgcolor="#E8F0F8"><a href="sort.jsp?classid=<%=request.getParameter("classid")%>&Nclassid=<%=request.getParameter("Nclassid")%>&order=size"  title="点击按降序排列"><font color="#000000">文件大小</font></a></td>
                      <td width="18%" align=center height="22" bgcolor="#E8F0F8"><a href="sort.jsp?classid=<%=request.getParameter("classid")%>&Nclassid=<%=request.getParameter("Nclassid")%>&order=hot"  title="点击按降序排列"><font color="#000000">评分</font></a></td>
                    </tr>
                  
                    <%		i=0;
		while(i<intPageSize&&rs.next()){%>
                    <tr bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#f8f8f8';" onMouseOut="this.style.backgroundColor='#ffffff';"> 
                      <td width="37%" height="22" bgcolor="#f8f8f8"> <a class="date" href="list.jsp?id=<%=rs.getString("id")%>" title="点击查看详细介绍"><%=rs.getString("showname")%>&nbsp;<%=replacenull(rs.getString("bb"))%></a></td>
                      <td height="22" width="11%"> 
                        <div align="center"><%=rs.getString("orders")%></div>
                      </td>
                      <td width="12%" align=center height="22"><%=rs.getString("dateandtime")%></td>
                      <td width="11%" align=center height="22"><%=rs.getString("hits")%></td>
                      <td width="11%" align=center height="22"><%=rs.getString("size1")%></td>
                      <td width="18%" align=center height="22"> 
                        <%String aaa=rs.getString("hot");
						int ddd=Integer.parseInt(aaa);
						int imghot=0;
						while(imghot<=ddd){
						%>
						<img src="images/grade1.gif">
						<%imghot++;
							}%>
                      </td>
                    </tr>
                    <% i++;}
							%>
                    <tr bgcolor="#FFFFFF"> 
                      <td colspan="6">&nbsp; </td>
                    </tr>
                    <tr bgcolor="#FFFFFF"> 
                      <td colspan="6"> 
                  <p align='center' vAlign='bottom'>
				第<%=intPage%>页 &nbsp;&nbsp;&nbsp;共<%=intPageCount%>页&nbsp;&nbsp;&nbsp;
				<%if(intPage<intPageCount){
					if(request.getParameter("Nclassid")==null){%>     
			<a href="sort.jsp?page=<%=intPage+1%>&classid=<%=request.getParameter("classid")%>">下一页</a>&nbsp;&nbsp;&nbsp;
				<%}else{%>	
	   <a href="sort.jsp?page=<%=intPage+1%>&classid=<%=request.getParameter("classid")%>&Nclassid=<%=request.getParameter("Nclassid")%>">下一页</a>&nbsp;&nbsp;&nbsp;
	            <%}   
					%>				
			
				<%}%>

				<%if(intPage>1){
					if(request.getParameter("Nclassid")==null){%>     
			<a href="sort.jsp?page=<%=intPage-1%>&classid=<%=request.getParameter("classid")%>">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			
				<%}else{%>	
	  <a href="sort.jsp?page=<%=intPage-1%>&classid=<%=request.getParameter("classid")%>&Nclassid=<%=request.getParameter("Nclassid")%>">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<%}%>
	            
				<%}   
					%>	
				</p>

                      </td>
                    </tr>
                  </table>
						  <%}%>
                </td>
              </tr>
            </table>
          </td>
        </tr>
        </tbody> 
      </table><br>
     </td>
  </tr>
</table>
<%@ include file="CopyRight.jsp"%>
</BODY></HTML>

⌨️ 快捷键说明

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