webtier@glassfish.java.net

JSF lifecycle: right time to create dynamic components?

From: <webtier_at_javadesktop.org>
Date: Wed, 21 Oct 2009 18:38:54 PDT

Hi guys,

First, thanks for all your work on Mojarra. It really is a first class JSF implementation.

I have a question about how the component tree gets serialized. Specifically, if I want my UIComponent to dynamically inject child components, what is the 'correct' place to do this?

Up until now, my project (metawidget.org) has been dynamically creating child components in .encodeBegin. This actually seems to work most of the time, but I realise the component tree has already been serialized before .encodeBegin is called, so creating new components there is a bit dangerous.

However, there don't seem to be any lifecycle events prior to .encodeBegin that I can hook into? There are plenty upon a POSTback (decode, processUpdates etc.), but for a first time GET request, .encodeBegin seems the earliest hook I have?

Is there a place I can hook in to the lifecycle BEFORE it tries to serialize the component tree so that I can modify the tree in advance?

Regards,

Richard.
[Message sent by forum member 'kennardconsulting' (richard_at_kennardconsulting.com)]

http://forums.java.net/jive/thread.jspa?messageID=368888