Originally posted by evan theon:
>Once the jsp page is rendered to the user, it is like any other web page. You >can save the page through the browser. Or is it that you want to do capture >the rendered page at the server side and then save it in the user's computer?
i am not sure which one is suitable for me, i just want to create a text file from a jsp page, just like creating an excel file from a jsp page using response.setContentType and response.setHeader, can it be done the same way? i've tried to change
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition","attachment;filename=file1.sxc");
into
response.setContentType("application/vnd.ms-word");
response.setHeader("Content-disposition","attachment;filename=file1.txt");
but i have a text file contained with the HTML source code, what i want is that the text file contains the HTML page that seen on user's screen not the HTML source code
what should i do?
It looks like there is a slight misunderstanding here.
Setting the content type to "application/vnd.ms-excel", does not cause the JSP to "create" an Excel page. The page you're creating is exactly the same as it would be with any other content type. All you're doing is sending a header to the browser which suggests that the browser open this file with the application associated with that content type (in this case Excel).
You don't see the HTML markup because Excel is capable of interpreting HTML and presenting it as a spread sheet.
If you instruct the browser to open a document in
Word and tell word that this is a text file (text meaning no markup), it's going to render it exactly the way it is written (markup and all).
I think Word can also interpret HTML. I know you can convert a Word
doc to HTML from within word (hideous html but that's another topic). Try leaving the content type as you have it but set the file extension to ".html" in the disposition tag.
It might work.
If not, look into Jakarta POI and see if you can create a "REAL" Word document on the server and stream that down to the client.
The truth is, there is no spoon Also:
please help.....i would be very thankful.....
Before adding another post to a
thread that looks like this, you might want to read:
Patience Is A Virtue to learn how you may actually be slowing down your answers.
[ September 10, 2005: Message edited by: Ben Souther ]