📄 index.jsp
字号:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="javax.naming.*,java.sql.*,javax.sql.DataSource"%>
<html>
<head><title>index</title></head>
<body>
点击下面的链接下载文件<p>
<a href="download.jsp?id=111">tomcat5.exe</a><br>
<%
Context ctx=new InitialContext();
DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/bookstore");
Connection conn=ds.getConnection();
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select id,filename from uploadfile");
while(rs.next())
{
%>
<a href="download.jsp?id=<%=rs.getInt(1)%>"><%=rs.getString(2) %></a><br>
<%
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -