為什麼你寫的下載檔案總是隻能下到伺服器本地
阿新 • • 發佈:2019-01-05
用httpRequestReponse reponse 或者Servlet的HttpServletResponse response
reponse.getOutputStream()輸出給客戶端。
獲取response和request的方法:
HttpServletRequest request = ServletActionContext.getRequest();
ServletContext servletContext = ServletActionContext.getServletContext();
request.getSession();
HttpServletResponse response = ServletActionContext.getResponse();
ActionContext ctx = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
參考:http://www.iteye.com/problems/94801
http://blog.csdn.net/superit401/article/details/77683893