saving files

Hi, does anyone know how to save a html page from a JSP page?For example, I have written html in a textarea then i have a button which on click will pop up the box "Save As", does anyone have any idea?
[223 byte] By [des_xu] at [2007-9-26 2:42:13]
# 1

It would seem the best way to do this would be to first save the HTML on the server as a txt file and then offer the user a chance to see it as rendered HTML or download the text version. That's the way I'd do it anyways. You could have a garbage sweeper running every hour or so to clean up old files.

Enygma42 at 2007-6-29 10:18:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

public void doGet(HttpServletRequest req, HttpServletResponse res)throws IOException

{

String fname=req.getParameter("fname");

String folder1=req.getParameter("folder");

String folder=folder1+"/"+fname+".pdf";

res.setContentType("application/octet-stream");

ServletOutputStream stream = res.getOutputStream();

BufferedInputStream fif =

new BufferedInputStream(new FileInputStream(folder));

int data;

while((data = fif.read()) != -1) {

stream.write(data);

}PrintWriter out = res.getWriter();

fif.close();

stream.close();

}

priviet at 2007-6-29 10:18:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
it will save current html page on your local machine
priviet at 2007-6-29 10:18:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
thx!!
des_xu at 2007-6-29 10:18:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...