You can generate your XML dynamically, and then write it to the response stream.
If you set the response headers correctly, the browser should treat
this response as a file downloading.

Code in your action looks like this:

public String execute() {
      String xmlStr = generateXML();

      HttpServletResponse response = ServletActionContext.getResponse();

      response.setContentType("text/xml");

      response.setHeader("Content-Disposition",
                        "attachment; filename=" + yourXmlFileName);

      OutputStream out = response.getOutputStream();

      out.write(xmlStr.getBytes("UTF-8"));

      out.close();

      return null;  // this make sure the page not to jump
}

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to