📄 index.jsp
字号:
<%@ page language="java"%>
<%@ page contentType="text/html; charset=GBK"%>
<%@ page import="java.sql.*,common.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/model/index/";
%>
<html>
<head>
<base href="<%=basePath%>">
<title>软件下载索引</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
body,td,th {
font-size: 12px;
}
</style>
</head>
<body>
<%@include file="top.htm"%>
<%
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
conn = DAO.getConnection();
stmt = conn.createStatement();
String sql = null;
%>
<table width="99%" border="1" align="center">
<tr>
<td>
<%
sql = "select c_id,c_departname from t_depart";
rs = stmt.executeQuery(sql);
while (rs.next()) {
%>
<a href="filelist.jsp?typeid=<%=rs.getInt(1)%>"><%=rs.getString(2)%>
</a>
<%
}
%>
</td>
</tr>
</table>
<table width="100%" height="296" class="border">
<tr>
<td width="20%" align="left" valign="top">
<table width="100%" border="1">
<tr>
<td align="center">
<strong>一级分类目录</strong>
</td>
</tr>
<%
sql = "set rowcount 20 select c_id,c_type_name from t_type where c_isdel=1 and c_fid=0";
rs = stmt.executeQuery(sql);
while (rs.next()) {
%>
<tr>
<td height="25">
<a href="model.jsp?typeid=<%=rs.getInt(1)%>"> <%=rs.getString(2)%>
</a>
</td>
</tr>
<%
}
%>
</table>
</td>
<td width="40%" align="left" valign="top">
<table width="100%" border="1">
<tr>
<td colspan="2" align="center">
<strong>最新收录</strong>
</td>
</tr>
<%
sql = "set rowcount 20 select c_id,c_name,c_describe,c_typeid,c_jointime from t_file where c_isdel=1 order by c_jointime desc ";
rs = stmt.executeQuery(sql);
while (rs.next()) {
%>
<tr>
<td width="70%" height="25">
<div align="center">
<a href="detail.jsp?fileid=<%=rs.getString("c_id")%>"
title="所在目录:<%=GetUrl.geturl(rs.getInt("c_typeid"))%>">
<%
String name = rs.getString("c_name");
if (name.length() > 20) {
name = name.substring(0, 20) + "...";
}
out.println(name);
%>
</a>
</div>
</td>
<td width="30%" height="25">
<%=rs.getString("c_jointime").substring(0, 10)%>
</td>
</tr>
<%
}
%>
</table>
</td>
<td width="40%" align="left" valign="top">
<table width="100%" border="1">
<tr>
<td colspan="2" align="center">
<strong>热门下载(top 20)</strong>
</td>
</tr>
<%
sql = "set rowcount 20 select c_id,c_name,c_hits from t_file where c_isdel=1 order by c_hits desc ";
rs = stmt.executeQuery(sql);
while (rs.next()) {
%>
<tr>
<td width="70%" height="25">
<a href="detail.jsp?fileid=<%=rs.getString(1)%>">
<%
String name = rs.getString("c_name");
if (name.length() > 20) {
name = name.substring(0, 20) + "...";
}
out.println(name);
%>
</a>
</td>
<td width="30%" height="25">
点击:
<%=rs.getString(3)%>
次
</td>
</tr>
<%
}
} catch (Exception ex) {
System.out.println("-----------" + ex.getMessage());
ex.printStackTrace();
}finally{
DAO.closeResource(rs);
DAO.closeResource(stmt);
DAO.closeResource(conn);
}
%>
</table>
</td>
</tr>
</table>
<%@include file="footer.jsp"%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -