1. 程式人生 > >為什麼你寫的下載檔案總是隻能下到伺服器本地

為什麼你寫的下載檔案總是隻能下到伺服器本地

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