Initialization method calls before page load


You can attach logic to the page load and post events. The page events are attached to the <hx: scriptCollector> tag of a JSF page.

The events are:

_ Page Load Begin : Before rendering (changes to managed beans take effect)
_ Page Load End : After rendering (changes to managed beans have no effect)
_ Page Post : When the page is submitted

The generated tag is:

<hx:scriptCollector id="scriptCollector1" preRender="#{pc_bean.onPageLoadBegin}"
postRender="#{pc_bean.onPageLoadEnd}" decode="#{pc_bean.onPagePost}">

Implementing page initialization

To illustrate page initialization we implement the Page Load Begin event to put
values into the number fields of the calculator bean, select the <hx:scriptCollector> tag either in the Source page, or in the design page in the menu bar of the JSP.

The method names “onPageLoadBegin”,” onPageLoadEnd” and “onPagePost” are keywords, so the implemented methods should have the same name.

No comments:

Post a Comment

Recent Posts

Popular Posts

© 2011-2019 Web Portal Club