Re: Struts2 - Generate XML in an Action, then direct user to download .xml

2010-10-13 Thread Grant Overby
Newton, Ying, Yang, Works like a charm. Thank you very much. gove...@students.kennesaw.edu On Wed, Oct 13, 2010 at 2:24 AM, Steven Yang wrote: > Hi Overby > > Result is indeed your choice to go. > in general you should avoid any direct use of the Servlet stuff in your > Actions. > > you shoul

Re: Struts2 - Generate XML in an Action, then direct user to download .xml

2010-10-12 Thread Steven Yang
Hi Overby Result is indeed your choice to go. in general you should avoid any direct use of the Servlet stuff in your Actions. you should prepare your data in your action or "execute" then determine what data type you want to return then return the proper "result" string then let your Result form

Re: Struts2 - Generate XML in an Action, then direct user to download .xml

2010-10-12 Thread Grant Overby
After some googling; I'm looking at the Result interface. Would it be proper for the action to set a property, and use this custom Result to read that property from ValueStack and write it to (with XStream for isntance) ServletActionContext.getResponse().getOutputStream() ? So Results exist for d

Re: Struts2 - Generate XML in an Action, then direct user to download .xml

2010-10-12 Thread Li Ying
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(); Http

Re: Struts2 - Generate XML in an Action, then direct user to download .xml

2010-10-12 Thread Dave Newton
Which version of Struts?! Stream result if Struts 2, handle the headers and return null if Struts 1. On Tuesday, October 12, 2010, Grant Overby wrote: > I've generated some XML in an action, and I'd like to direct the user to > download it. It should be have as if they clicked a link pointing to