If you need to read a property on a custom control and do something to any component on the page before a page loads, it can get tricky because the compositeData
object is not available in the beforeRenderResponse
event and getComponent()
does not work in the beforePageLoad
event.
I have an application where I need to dynamically inject components before a page loads. However, the injection depends on custom properties on a custom control, so it needs to read the properties and then get a handle to a component and modify it. Since the compositeData
object isn’t available in the beforeRenderResponse
event and getComponent()
doesn’t work in the beforePageLoad
event, there’s no single place to put the code that I need.
Fortunately, there’s a simple workaround. Code in the beforePageLoad
event can read custom properties from the compositeData
object and store them in viewScope
variables. Then, code in the beforeRenderResponse
event can read those values from viewScope
and use getComponent()
to get the handle to the component that I need to modify.
