File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Capturing dynamic generated HTML Content on action call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Capturing dynamic generated HTML Content on action call" Watch "Capturing dynamic generated HTML Content on action call" New topic
Author

Capturing dynamic generated HTML Content on action call

mozammil muzza
Ranch Hand

Joined: Dec 22, 2011
Posts: 32

Hi,

I am trying to capture dynamic generated html content on server side on command button's action call, but not able to get the exact dynamic content.

Let's say, i have one page which displays items in data table with check boxes (grid) and when i select some checkbox and click on some command button (preview), it takes me to the next view where all informations of this selected items shows in panels as preview, then i have one button (command button) on preview page on whose click complete preview page should be send as an email (html email) as an action call.
So on this action call, i want to capture this preview page html content, so that i can send this as an email.

I am not able to get the contents on server side.


Please help me, how can i achieve this. :)


Khuda Haafiz Muzza 4 Java
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

There isn't any easy way to do this.

You are better off doing a separate HTML format to produce the email body text. If you prefer to use a template to generate that HTML, there are a number of template engines that can do the job. A current project of mine uses the Apache Velocity engine for that purpose.


Customer surveys are for companies who didn't pay proper attention to begin with.
mozammil muzza
Ranch Hand

Joined: Dec 22, 2011
Posts: 32

thanks Tim for reply,

actually here i am able to get the content using URL openStream method.
But as i am using JSF with Primefaces, when i am sending that html content as mail body, its not rendering correctly.

On Outlook, it is coming as raw xthml content.

Is there any other way i can show this on mail in the same way how it is rendering on browser .
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

I don't know what you are doing, but if you are getting "xhtml" back, you are not running the request through JSF. JSF only uses the xhtml (View Definition Language) resources as templates for the FacesSerlet to process and render as the output HTML.

mozammil muzza
Ranch Hand

Joined: Dec 22, 2011
Posts: 32

content what i am getting on server side is same that i can see on right click and view source of the page.
but problem now i am getting is, when attaching this content to mail's body and sending it, it is not getting rendered on MS Outlook as html, but simpy coming as raw html text, i.e. <html> <body> ...

Please suggest how i can send this content as a mail so that i can be rendered as html page on Outlook.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Capturing dynamic generated HTML Content on action call