You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dave <ja...@yahoo.com> on 2007/06/11 16:31:56 UTC

How to email a JSF page?

Hi,  I am using JSF on JBoss.  Recently I got a requirement to email a page to users.
   
  How to email a JSF page?  When a user opens the email, s/he should see the whole JSF page (rendered HTML page).
   
  Basically my question is: how to generate HTML code from a JSF page on server side so that I email the generated HTML?
   
  Thanks for any info.
  Dave

 
---------------------------------
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.

Re: How to email a JSF page?

Posted by David Steinkopff <da...@googlemail.com>.
Hi Dave,

if you need only the rendered page you can use an InputStream over HTTP.

an example

new URL("localhost:8080/page.jsf").openStream() return an InputStream
object.

regards
David

2007/6/11, Dave <ja...@yahoo.com>:
>
> Hi,  I am using JSF on JBoss.  Recently I got a requirement to email a
> page to users.
>
> How to email a JSF page?  When a user opens the email, s/he should see the
> whole JSF page (rendered HTML page).
>
> Basically my question is: how to generate HTML code from a JSF page on
> server side so that I email the generated HTML?
>
> Thanks for any info.
> Dave
>
> ------------------------------
> TV dinner still cooling?
> Check out "Tonight's Picks"<http://us.rd.yahoo.com/evt=49979/*http://tv.yahoo.com/>on Yahoo! TV.
>
>

Re: How to email a JSF page?

Posted by Andrew Robinson <an...@gmail.com>.
Sorry, it was a guess. A quick search of the code didn't give one
specific time when the ResponseWriter is created. Does the
specification say anything about when it is created?

On 9/16/07, Manfred K. <ai...@chello.at> wrote:
>
> Hi Andrew,
>
> how can you "wrap the response writer in a custom phase listener"?
>
> facesContext.getResponseWriter() returns null in a phaselistener or custom
> viewhandler!
>
> Best Regards
>
>
>
> Andrew Robinson-5 wrote:
> >
> > One idea could be to write a custom phase listener that wraps the
> > ResponseWriter, buffers all the output and then after the render
> > response phase, sends the contents in the body of an HTML email.
> >
> > -Andrew
> >
> > On 6/11/07, Dave <ja...@yahoo.com> wrote:
> >> Hi,  I am using JSF on JBoss.  Recently I got a requirement to email a
> >> page
> >> to users.
> >>
> >> How to email a JSF page?  When a user opens the email, s/he should see
> >> the
> >> whole JSF page (rendered HTML page).
> >>
> >> Basically my question is: how to generate HTML code from a JSF page on
> >> server side so that I email the generated HTML?
> >>
> >> Thanks for any info.
> >> Dave
> >>
> >>  ________________________________
> >> TV dinner still cooling?
> >> Check out "Tonight's Picks" on Yahoo! TV.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/How-to-email-a-JSF-page--tf3901920.html#a12718352
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: How to email a JSF page?

Posted by "Manfred K." <ai...@chello.at>.
Hi Andrew,

how can you "wrap the response writer in a custom phase listener"? 

facesContext.getResponseWriter() returns null in a phaselistener or custom
viewhandler!

Best Regards



Andrew Robinson-5 wrote:
> 
> One idea could be to write a custom phase listener that wraps the
> ResponseWriter, buffers all the output and then after the render
> response phase, sends the contents in the body of an HTML email.
> 
> -Andrew
> 
> On 6/11/07, Dave <ja...@yahoo.com> wrote:
>> Hi,  I am using JSF on JBoss.  Recently I got a requirement to email a
>> page
>> to users.
>>
>> How to email a JSF page?  When a user opens the email, s/he should see
>> the
>> whole JSF page (rendered HTML page).
>>
>> Basically my question is: how to generate HTML code from a JSF page on
>> server side so that I email the generated HTML?
>>
>> Thanks for any info.
>> Dave
>>
>>  ________________________________
>> TV dinner still cooling?
>> Check out "Tonight's Picks" on Yahoo! TV.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-email-a-JSF-page--tf3901920.html#a12718352
Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: How to email a JSF page?

Posted by William Hoover <wh...@nemours.org>.
Just to expand on Andrew's comment...

In your listener add this piece of code:

ExtensionsResponseWrapper extRespWrapper = (org.apache.myfaces.webapp.filter.ExtensionsResponseWrapper) FacesContext.getCurrentInstance()
				.getExternalContext().getResponse();
String currentResponseHTML = new String(extRespWrapper.getBytes());

... now you can email the html

-----Original Message-----
From: Andrew Robinson [mailto:andrew.rw.robinson@gmail.com]
Sent: Monday, June 11, 2007 10:50 AM
To: MyFaces Discussion
Subject: Re: How to email a JSF page?


One idea could be to write a custom phase listener that wraps the
ResponseWriter, buffers all the output and then after the render
response phase, sends the contents in the body of an HTML email.

-Andrew

On 6/11/07, Dave <ja...@yahoo.com> wrote:
> Hi,  I am using JSF on JBoss.  Recently I got a requirement to email a page
> to users.
>
> How to email a JSF page?  When a user opens the email, s/he should see the
> whole JSF page (rendered HTML page).
>
> Basically my question is: how to generate HTML code from a JSF page on
> server side so that I email the generated HTML?
>
> Thanks for any info.
> Dave
>
>  ________________________________
> TV dinner still cooling?
> Check out "Tonight's Picks" on Yahoo! TV.
>
>


Re: How to email a JSF page?

Posted by Andrew Robinson <an...@gmail.com>.
One idea could be to write a custom phase listener that wraps the
ResponseWriter, buffers all the output and then after the render
response phase, sends the contents in the body of an HTML email.

-Andrew

On 6/11/07, Dave <ja...@yahoo.com> wrote:
> Hi,  I am using JSF on JBoss.  Recently I got a requirement to email a page
> to users.
>
> How to email a JSF page?  When a user opens the email, s/he should see the
> whole JSF page (rendered HTML page).
>
> Basically my question is: how to generate HTML code from a JSF page on
> server side so that I email the generated HTML?
>
> Thanks for any info.
> Dave
>
>  ________________________________
> TV dinner still cooling?
> Check out "Tonight's Picks" on Yahoo! TV.
>
>