This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I need to save the generated html page (on the server) as a html or pdf file.I was thinking of writing a filter/servlet which does this before the page is displayed . Is this something which can be achieved ? Can the OutputStream that is deliverd to the webpage be converted to something.html before it is rendered ? Please advise. Thank you .
. . . if you finally decide to bump the post, please try to do so by posting more information! After all, if nobody answered, that's probably because nobody did know an answer.
Your question is quite vague. Are you generating the HTML in a servlet and writing it to the OutputStream? That can be solved with something like the Unix tee command. Create a custom OutputStream that writes one value to two outputs. If you are using JSP's, I don't know if what you want to do is possible, so give us some more details and we may give you more options.
Sorry for not being very specific. I am using the struts framework and jsp pages are generated using the framework .I need a image or a static html version of the jsp page that was filled out by the user , I was able to create a filter and also wrote wrappers around HttpServletResponseWrapper and ServletOutputStream and save the stream to a file as html file. But I have to read back the saved file and display it to the user.
Here is the code snippet
Now that I got that working , this page may or maynot be accessed by the user, I wanted to know If I could call a jsp file and provide the sessionId or something so that I can save the review page behind the scenes.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Jun 15, 2005
yeah something similar to that. I am trying to get this piece of code working now.
Where FileResponseStream and FileResponseWrapper are wrappers around the HttpServletResponseStream and HttpServletResponse. I do not get anything back , my byte is 0 .
Joined: Jun 15, 2005
Just In case anybody was intersted, I got around this problwm by using a custom JSP tag that takes the bodycontent and writes to a file. So I just did this in the jsp , so the content of this page is written out to a file. <capture:bodyGrab><jsp:include page="/myPage.jsp" flush="true" /></capture:bodyGrab>