retrieving files from database by their path in jsp

前端 未结 2 1423
梦谈多话
梦谈多话 2021-01-27 23:38

i want to download a file by its path(local server path) which is stored in a database table ,i have done the coding part to view the database in a html table but i dont have an

2条回答
  •  甜味超标
    2021-01-28 00:17

     <%@ page import="java.io.*,java.sql.*"%>
     <%
       String id=request.getParameter("id");
       Class.forName("com.mysql.jdbc.Driver").newInstance();  
       Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ksa","root","root");  
       Statement st=con.createStatement();
       ResultSet rs=st.executeQuery("Select id,file_path,file_date from file12 where id like '"+id+"%'"); 
       %>
      
      <%
        while(rs.next()){
      %>
      
     <%}%>
    
    "> click here to download the file with id :<%=rs.getString("id")%>

提交回复
热议问题