Mike Wright wrote:
> Hi Ken,
>
> Thanks. I'll work this in to my commits, as soon as I need to
> integrate a managed bean or navigation rule.
> Where can I find documentation (or an example or a testcase) that
> shows how to use initPage?
In the admin-gui/admin-jsf directory the "header.jsf" page uses the
"initPage" event.
There isn't any great documentation... however, I sent out an email
earlier (see:
https://jsftemplating.dev.java.net/servlets/ReadMsg?list=dev&msgNo=49)
that gave some information. One thing I'd add to that documentation is
that this event must be at the "top-level"... in other words, not inside
any other components / tags. At the top of the page is a good spot.
> How do I convert my old-syntax selectedTab setting to the new syntax?
Do you mean the TabSet "selected" property? If so, just do:
<sun:tabSet selected="whatever...">
You can make "whatever" be something like: "$option{somekey}"... this
would allow you to include the tabs and define the selected page
somewhere else. If I remember correctly, this is similar to what you
were doing before.
> Which is better to use: initPage or beforeCreate? What's the syntax?
*initPage*
*beforeCreate
*
Available at page-level *only*
Available on any component.
Invoked on EVERY request for a page.
Invoked on "initial" requests (only when a component is created).
Invoked just after tree creation (initial requests).
Invoked during tree creation (initial requests).
Invoked during restoreView phase (subsequent requests).
Not invoked (subsequent requests).
The above are some general differences... The "initPage" is good if you
have to initialize something for the life of the request. If this
initialized information is transient and you need it while processing a
post, then the "initPage" will fire again to do this for you.
"beforeCreate" will only fire the 1st request.... many times this is
sufficient and you can store your information along w/ the UIComponent tree.
> Which docroot/appServer/*.jsf file demonstrates something similar to
> what I'm trying to do (as we discussed by phone). Which .java source
> file should I read, if there is no doc, example, or testcase?
header.jsf is one example. If you want to look at Handler code (which I
think you have plenty of examples already), you can look in the
"...handlers" package (initPage uses the same types of handlers as all
other events). If you want to look at how / when its fired, you'll need
to look through LayoutDefinitionManager.java,
TemplateLayoutDefintionManager.java, XMLLayoutDefintionManager.java,
InitPageEvent.java, and LayoutDefintion.java.
Good luck!
Ken
> Regards,
> Mike
> ---
> Ken Paulsen wrote: