Hi Madhav,
This is an interesting requirement. Off the top of my head I'd say you could probably make a custom component to wrap the section you want to capture. Then in that components renderer, in the encodeBegin method you switch the responseWriter to a StringWriter or some other writer. Then in encodeEnd you save the contents of the StringWriter somewhere you can use it later and set back the correct responseWriter, and if you still want to write the response you can do so. Also you need to override rendersChildren and have it return true. The code would look something like this. private ResponseWriter oldWriter; private StringWriter sWriter; // encodeBegin sWriter = new StringWriter(); HtmlResponseWriterImpl writer = new HtmlResponseWriterImpl(sWriter, "text/html","utf-8"); oldWriter = context.getResponseWriter(); context.setResponseWriter(writer); //encodeEnd StringBuffer sb = sWriter.getBuffer(); // do what you want with the sb context.setResponseWriter(oldWriter); // if you want to output it as well... oldWriter.write(sb.toString()); I think this may work for what you want to do. Matt ________________________________ From: Madhav Bhargava [mailto:[EMAIL PROTECTED] Sent: mercredi 3 décembre 2008 11:51 To: MyFaces Discussion Subject: Attach the current JSF View as an attachment Hi All, I have a rather unique requirement - On a JSF page I have a command button. On click of this button I want to capture the generated HTML for the current view I am on, truncate the left navigation, header and the footer. Extract the body HTML and open a save dialog box to save this HTML page with only body as attachment. Any ideas of how it could be done using JSF? Thanks, Madhav **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS******** End of Disclaimer ********INFOSYS***

