SpringMVC当中请给出一个下载的例子,文件名必需是中文

4.文件下载

例4.1:

<%@ page contentType="text/html; charset=GBK" %>
<html>
<body >
<A href="http://localhost:8080/SpringMVC1/DownLoad.do?file=ibatis环境搭建.ppt">下 载ibatis环境搭建.ppt</A>
</body>
</html>



package com;
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.ServletConfigAware;
import org.springframework.web.context.ServletContextAware;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.support.RequestContextUtils;

版权保护,原文出处:http://www.mark-to-win.com/index.html?content=Frame/frameUrl.html&chapter=Frame/SpringMVC_web.html#SpringMVCDownload

猜你喜欢

转载自blog.csdn.net/mark_to_win/article/details/88695600