dev@jsftemplating.java.net

Re: JSFTemplating: Events/Handlers

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Fri, 21 Sep 2007 19:48:32 -0700

Karam Singh Badesha wrote:
> It would be good to put information like this on the website which
> developers can benefit from.
Yes it would! Volunteers? :) I will do this when I can find time... I
still need to publish the content Leonid sent me last week, though. :(
>
> thanks
> Karam
>
> Leonid Lamburt wrote:
>> Hi,
>>
>> can anyone please provide a short description for each of these
>> events (see tab below), specifically
>> where they occur in JSF lifecycle of a single request ?
>>
>> <!initPage /> - fired for each request when the view is restored (
>> this one is described in JavaDoc)
>> <!command /> - ?
This event can be used in place of an action/actionListener. This is
for buttons/hrefs (ActionSource) types. It can be applied to ANY
ActionSource, just put this event inside the button/href you want to
execute this event.
>> <!beforeEncode /> -?
Only works for JSFTemplating-based components due to a technical
limitation (which will be removed in the future). This means you may
have to place an <event> component in the tree where you want to execute
this event. This event executes during the Render Response phase just
before rendering the component on which it exists. The
JSFTemplating-based components include (if, foreach, event, staticText).
>> <!afterEncode /> -?
Same as beforeEncode except that it is fired AFTER the encoding of the
component on which it is attached.
>> <!encode /> -?
Same as before/afterEncode, but happens DURING the encoding of the
component right before it encodes its children. For looping components,
this will get fired multiple times (once for each iteration of the loop).
>> <!decode /> -?
This is only used when writing components. This event handles the
decode functionality of the Renderer.
>> <!beforeCreate /> -?
This gets fired during the Restore View phase (normally). It is fired
before the component it is associated with is created. JSFTemplating
fully instantiates the known UIComponent tree during the Restore View phase.
>> <!afterCreate /> -?
Same as beforeCreate, but happens after the component (but NOT its
children) are created.
>> <!beforeLoop /> -?
Only valid for looping JSFTemplating components (foreach / while). It
gets fired BEFORE the loop starts iterating.
>> <!afterLoop /> -?
Only valid for looping JSFTemplating components (foreach / while). It
gets fired AFTER the loop is completely done iterating.
>> <!createChild /> -?
This is a new one I recently added. This event may be used by Component
Factories when they choose to create children of the component in which
they are asked to create. For example, the
DynamicColumnTableRowGroupFactory not only creates a TableRowGroup
component, but creates children of the TableRowGroup (based on data
passed into the factory). When it creates these children, it fires this
event allowing the page author to execute handlers during this event
(i.e. so the page author can do something special during the creation of
those children). Currently this is the only factory that uses this event.
>> Also, please confirm for these handlers:
Yes, you are correct about all of the handlers below. Remember you can
view the "info.jsf" page in debug mode to see a complete list of
handlers and the files which define them. There are JavaDoc for all the
handlers below (I believe).

Thanks for the very good questions! I hope I (or someone else) can get
this info published on the site soon! I've flagged this message so I
can remember to come back to it.

Ken
>>
>> setAttribute / getAttribute / dumpAttributes : manipulates attr's in
>> requestScope
>> setSessionAttribute / getSessionAttribute / dumpSessionAttributes :
>> .... sessionScope
>> setApplicationAttribute / getApplicaitonAttribute /
>> dumpApplicationAttributes : ..... applicaitonScope
>>
>>
>> Thanks in advance.
>>
>> ------------------------------------------------------------------------
>> Gear up for Halo® 3 and get a $25 Best Buy gift card. It’s our way of
>> saying thanks for using Windows Live™. Get it now!
>> <http://gethalo3gear.com?ocid=SeptemberWLHalo3_WLHMTxt_1>