HTML and CSS Reference
Table 4-3. JSF System Events on the Component Level (Extends ComponentSystemEvent)
This event is published just before the rendering of the component.
This event is published just after the component is added to the JSF view.
This event is published just before the component is about to be validated.
This event is published just after the component is validated.
This event is published just before the view scope map is about to be destroyed.
This event is published just after the view scope map is created.
This event is published just before the view ( UIViewRoot ) is about to be rendered.
This event is published just after the component state is restored.
In order to see how we can use System events in order to empower our JSF applications, let's get back to the
subscriber application which we created in Chapter 3. Assume that we want to introduce a new drop-down item that
will include list of professions, as shown in Figure 4-8 . The list of professions is static in the application, so it will be
loaded once when the application starts and will be unloaded before the application shuts down.
Figure 4-8. The updated subscriber application screen
In order to implement this functionality, we can use PostConstructApplicationEvent to load the static
listing data just after the application starts and PreDestroyApplicationEvent to make any cleanup just before the
Listing 4-20 shows our application's custom SystemEvent listener, which will be called just after the application
starts and just before the application shuts down.
Listing 4-20. Subscriber Custom SystemEvent Listener
Search WWH ::