1 / 6
文档名称:

jsp如何实现下载文件的功能.doc

格式:doc   大小:28KB   页数:6页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

jsp如何实现下载文件的功能.doc

上传人:xunlai783 2018/1/7 文件大小:28 KB

下载得到文件列表

jsp如何实现下载文件的功能.doc

文档介绍

文档介绍:jsp如何实现下载文件的功能
第一步:创建Servlet   
第二步:写代码‍
public class FielDownLoad extends HttpServlet {
/**
* Constructor of the object.
*/
public FielDownLoad() {
   super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
   (); // Just puts "destroy" string in log
   // Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* ***@param request the request send by the client to the server
* ***@param response the response send by the server to the client
* ***@throws ServletException if an error occurred
* ***@throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
   doPost(request, response);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* ***@param request the request send by the client to the server
* ***@param response the response send by the server to the client
* ***@throws ServletException if an error occurred
* ***@throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
   String filename = ("file_name");
        
         if