Hi,

in beforePhase:

    // replace responseWriter
    StringWriter content = new StringWriter();
    ResponseWriter contentWriter = writer.cloneWithWriter(content);
    facesContext.setResponseWriter(contentWriter);

and in afterPhase you can get the content out of the StringWriter.


Regards,
    Volker


2007/9/13, Alexander Lendl <[EMAIL PROTECTED]>:
>
> Thanks again Volker... sorry for this stupid question, but can you please
> tell me, how to get the html content as string out of the ResponseWriter?
>
> facesContext.getResponseWriter() gives me an HtmlResponseWriterImpl with a
> JspWriterImpl which includes  the desired content in a char array, but I
> can't access the JspWriterImpl.
>
> TIA
>
>
> Volker Weber-5 wrote:
> >
> > Hi,
> >
> > to get the rendered html you can, as described in the thread, replace
> > the responsewriter
> > before rendering. Than you can get the writers content after
> > rendering. I think this should be possible also i  a PahseListener in
> > before and after renderResponse phase.
> >
> > to prevent faces to do anything more with this request you can just
> > call facesContext.responseComplete().
> >
> >
> > Regards,
> >     Volker
> >
> >
> >
> > 2007/9/13, Alexander Lendl <[EMAIL PROTECTED]>:
> >>
> >> Volker, thanks for your quick reply... I don't think that this thread can
> >> really help me with my problem.
> >>
> >> It's not necessary that the required functionality happens in a
> >> PhaseListener (could also be in a servlet, servlet filter, custom jsp
> >> tag,
> >> ...). All I need is to get the rendered html output of a jsf view and
> >> prevent faces from forwarding to the corresponding page (because the
> >> output
> >> should only be included in a template jsp).
> >>
> >>
> >>
> >> Volker Weber-5 wrote:
> >> >
> >> > Hi Alexander,
> >> >
> >> > not sure if this is possible in a phaseListerner, i think it sould be,
> >> > but you may look at this thread for a possilbel solution:
> >> >
> >> >
> >> http://www.nabble.com/Change-visibility-dinamically-tf3299810.html#a9202172
> >> >
> >> >
> >> > Regards,
> >> >     Volker
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/include-rendered-JSF-output-in-JSP-page-tf4434536.html#a12653151
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/include-rendered-JSF-output-in-JSP-page-tf4434536.html#a12655734
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Reply via email to