Hi,

you can set a custom responseWriter into the facesContext and call
encode methods on the component.

like this:

// backup the writer
ResponseWriter writer
    = (ResponseWriter) facesContext.getResponseWriter();

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

// encode the component
component.encodeBegin(facesContext);
component.encodeChildren(facesContext);
component.encodeEnd(facesContext);

// reset the writer
facesContext.setResponseWriter(writer);

// get the content from StringWriter
String htmlSource = content.toString();


Regards
  Volker

Onur Tokan wrote:
> Sorry, I'm afraid I'm misunderstood. I looking for a method which will
> give me the only components and sure It's child's HTML source. This
> should be a String value.
> 
> 
> On 11/21/05, Andrew Robinson <[EMAIL PROTECTED]> wrote:
> 
>>Yes. If you want an example, there is one at this site:
>>http://www.theserverside.com/articles/article.tss?l=BuildingCustomJSF
>>
>>Look for 'Building the"HelloWorld" Custom UI Component Step 1:
>>Creating a UIComponent Class'
>>
>>On 11/21/05, Onur Tokan <[EMAIL PROTECTED]> wrote:
>>
>>>Hi,
>>>
>>>Is it possible for a component render itself?
>>>
>>>like:
>>>
>>>public String HtmlDataTable.renderHtml()
>>>
>>>best regards...
>>>
>>
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Reply via email to