This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I have a servlet which throws an HTML page with a button "Save this page as Text". If the user clicks on the button, I want to create a file in the user's computer and write some data. How do I achieve this?
Jesse Tilly
Ranch Hand
Joined: Jun 25, 2000
Posts: 37
posted
0
A couple of ways. The button could trigger JavaScript that requests a file you've created server-side. The user will be asked if it's okay to save/run it. The button could also POST to a servlet that "responds" as a file rather than as HTML. The browser will handle it according to its MIME settings. Or, the button could trigger JavaScript that makes the servlet request generating a dynamic filestream (no messy temp files). Jesse