title: Spring - download file and redirect
body: <p>I have a download link on my page which works just fine but it doesn't refresh/redirects my page. Here's my code.</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.POST, params = "exportToXML")
  public String exportToXML(HttpServletResponse response, Model model, @ModelAttribute(FILTER_FORM) ScreenModel form,
          BindingResult result, OutputStream out,
          HttpSession session) throws IOException {
      ZipOutputStream zipout;
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
  
  
          zipout = new ZipOutputStream(baos);
          ZipEntry ze = new ZipEntry("file.xml");
          zipout.putNextEntry(ze);
          zipout.write(string.getBytes());
          zipout.closeEntry();
          zipout.close();
          baos.close();
  
  
      response.setContentType("application/vnd.ms-excel");
      response.setHeader("Content-disposition", "attachment; filename=xx.zip");
      response.getOutputStream().write(baos.toByteArray());
      response.getOutputStream().close();
      response.getOutputStream().flush();
      return VIEW_NAME;
  }
  </code></pre>
  
  <p>I've removed irrelevant pieces of code to make it a little bit shorter. I have also tried with @ResponseBody but it gives the same result as code above.
  Any advice will be helpful</p>