📄 class.jsp
字号:
<%@ include file="conn.jsp"%>
<%!
String replacenull(String a){
if(a==null){
return " ";
}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">
</HEAD>
<%@ include file="head.jsp"%>
<%@ include file="lanmu.jsp"%>
<br>
<table width="770" border=0 cellspacing="0" cellpadding="0">
<tr>
<%
sqlname="select * from scott.home";
ResultSet rs3=stmt.executeQuery(sqlname);
if(rs3.next()){
%>
<td class="4b" height="22">当前位置:<a href="<%=rs3.getString("url")%>"><%=rs3.getString("home")%></a>>>
<a href="<%=rs3.getString("urls")%>"><%=rs3.getString("homes")%></a>>> <a href="class.jsp?classid=<%=request.getParameter("classid")%>"><%=classname%></a>
>> <%=Nclassname%> </td>
<%}%>
</tr>
</table>
<br>
<table border="0" cellpadding="1" cellspacing="0" width="770" id="AutoNumber1">
<tr>
<td width="170" valign="top"> <table border=0 cellpadding="0" cellspacing="0" width="168" height="73">
<tr>
<td width="174" height="22" class="li"> 搜索引擎</td>
</tr>
<tr bgcolor=#ffffff>
<td width="174" align="center" class="3b" background="pic/a-27.gif" bgcolor="#ffffff"><TABLE width="98%" height="63" border=0 align=center cellPadding=0 cellSpacing=2>
<FORM action=query.jsp method=POST name="myfrom">
<TR>
<TD> <input onfocus="this.value=''" maxLength="50" size="17" title="输入关键字" value="输入关键字" name="keyword" type="text">
</TD>
</TR>
<TR>
<TD><input type="radio" value="title" checked name="action">
名称
<input type="radio" name="action" value="content">
简介<font color="#FFFFFF"> </font></TD>
</TR>
<TR>
<TD><input type=submit value="搜 索" name=Submit> <a href="search.jsp">
高级搜索...</a></TD>
</TR>
</FORM>
</TABLE></td>
</table>
<br>
<table width="168" border=0 cellpadding="0" cellspacing="0">
<tr>
<td class="li" height="22"><%=classname%>分类</td>
</tr>
<tr>
<td class="3b" background="pic/a-27.gif">
<% 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")+"'";
}
ResultSet rs=stmt.executeQuery(sqlname); %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%while(rs.next()){%>
<tr>
<td align="right" width="10%" >·</td>
<td width="90%">
<span style="letter-spacing: 2pt"> <a href="class.jsp?classid=<%=request.getParameter("classid")%>&Nclassid=<%=rs.getString("Nclassid")%>"><%=rs.getString("Nclass")%></a></span>
</td>
<%}
rs.close();
%>
</table>
</td>
</tr>
</table>
<br>
<table width="168" border=0 cellpadding="0" cellspacing="0">
<tr>
<td class="li" height="22"><%=classname%>排行</td>
</tr>
<tr>
<td background="pic/a-27.gif" class="3b">
<%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=software.jsp?id="+rs.getString("id")+">"+rs.getString("showname")+" "+replacenull(rs.getString("bb"))+"</A></li>");
}
rs.close();
%>
</td>
</tr>
</table>
</td>
<td align="right" valign="top" width="596">
<% int intPageSize;
int intRowCount;//记录总数
int intPageCount;//总页数
int intPage;//页面参数
String strPage;//定义变量用来传递page
int j;
intPageSize=4;//定义每页显示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="595" bordercolordark=#ffffff bordercolorlight=#18A6FF border=1 cellspacing="0" cellpadding="0" height="22" background="pic/bar.gif">
<tr>
<td height="14" width="258"> 软件名称</td>
<td width="87" align="center" height="14">更新日期</td>
<td width="62" align="center" height="14">下载次数</td>
<td width="71" align="center" height="14">文件大小</td>
<td width="105" align="center" height="14">软件评级</td>
</tr>
</table>
<table bordercolordark=#ffffff bordercolorlight=#18A6FF border=1 width="595" cellspacing="0" cellpadding="0">
<% i=0;
while((i<intPageSize)&&rs.next()){%>
<tr>
<td width="258" height="22"> <img src="images/isList.gif" width="13" height="13">
<a href="software.jsp?id=<%=rs.getString("id")%>" title="<%=rs.getString("note")%>"><b><font color="#000000"><%=rs.getString("showname")%></font></b>
</a></td>
<td width="87" align="center" height="22"><%=rs.getString("dateandtime")%></td>
<td width="62" align="center" height="22"><%=rs.getString("hits")%></td>
<td width="71" align="center" height="22"><%=rs.getString("size1")%></td>
<td width="105" align="center" height="22">
<%String aaa=rs.getString("hot");
int ddd=Integer.parseInt(aaa);
int imghot=0;
while(imghot<=ddd){
%>
★
<%imghot++;
}%>
</td>
</tr>
<tr>
<td colspan="5"> · <%=rs.getString("note")%>...... </td>
</tr>
<tr>
<td colspan="3" height="23"><font color="green">运行平台:</font><%=rs.getString("system")%>
<font color="green">软件性质:</font><%=rs.getString("orders")%>/<%=Nclassname%></td>
<td colspan="2" height="23"><font color="green">人气:</font> <%=rs.getString("hits")%>℃
</td>
</tr>
</table>
<br>
<table width="595" bordercolordark=#ffffff bordercolorlight=#18A6FF border=1 cellspacing="0" cellpadding="0">
<% i++;
}
%>
<tr>
<td>
<p align='center' vAlign='bottom'>
第<%=intPage%>页 共<%=intPageCount%>页
<%if(intPage<intPageCount){
if(request.getParameter("Nclassid")==null){%>
<a href="class.jsp?page=<%=intPage+1%>&classid=<%=request.getParameter("classid")%>">下一页</a>
<%}else{%>
<a href="class.jsp?page=<%=intPage+1%>&classid=<%=request.getParameter("classid")%>&Nclassid=<%=request.getParameter("Nclassid")%>">下一页</a>
<%}
%>
<%}%>
<%if(intPage>1){
if(request.getParameter("Nclassid")==null){%>
<a href="class.jsp?page=<%=intPage-1%>&classid=<%=request.getParameter("classid")%>">上一页</a>
<%}else{%>
<a href="class.jsp?page=<%=intPage-1%>&classid=<%=request.getParameter("classid")%>&Nclassid=<%=request.getParameter("Nclassid")%>">上一页</a>
<%}%>
<%}
%>
</p>
</td>
</tr>
</table>
<%}%>
</td>
</tr>
</table>
<br>
<%@ include file="foot.jsp"%>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -