Thursday, February 18, 2010

ADF UI Shell: Automatically Open a Default Activity Upon Page Load

I am watching the Oracle UI Shell Functional Pattern thread at OTN and noted that some people were interested on how to automatically open a default activity in ADF UI Shell. I decided to take up the challenge and came up with the following.

This post is just a demonstration on how to open a default activity upon page load in ADF UI Shell, based on the accompanying sample application named "UISHellSherman_V02".
Let us simulate the concept using the page First.jspx.
  1. Add the Trinidad HTML Components 1.2 JSP Tag Library on the uiShellViewController project
  2. Open First.jspx and add the Trinidad "trh" tag declaration on the jsp root. The jsp root declaration should look like the following:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="" version="2.1"
  3. Add the following client and server listeners:
    <af:document id="d1" title="First Page">
          <af:clientListener method="initialize" type="load" />
            <af:serverListener type="launchDefaultActivity"
                               method="#{backingBeanScope.launcher.launchDefaultActivity}" />

  4. Right-click the line <af:document id="d1" title="First Page"> click Facets -document, then enable the Meta Container facet.
    Modify the Meta Container facet to reflect the following:
    <f:facet name="metaContainer">
                function initialize(event) {
                    var source = event.getSource();
  5. Add a launchDefaultActivity() method on the Launcher class.
    public void launchDefaultActivity(ClientEvent clientEvent) {
              "The Default Activity",
  6. Run the First.jspx

Related Posts



  1. Thanks very much for this Pino, saved me some work, which I always appreciate!

    Couple little tweaks:

    1) Under JDev 11g PS1 the Javascript code can be placed inside an af:resource tag, therefore not requiring the Trinidad Library.

    2) There are a couple of situations where the on-load event will be called when rendering another activity/tab in first.jspx. As such in the launchDefaultactivity method you can wrap the _launchActivity call with:

    if (TabContext.getCurrentInstance().getSelectedTabIndex() == -1)

    Thanks again for your assistance, appreciated.


  2. Hi.

    Initial opened tab works fine.
    I found one use case where it does not work.
    If I add for example one table in "navigation" facet than tab is not initially opened.
    After I do a browser refresh it does work.

    How to bypass this issue?


  3. Hi Pino,

    By default close icon on dynamic tab is shown at the end
    We have a requirement to show the close icon on tab itself just like in 11.1.2
    but we have to do this in
    Can you help us with steps ?
    Please drop a mail to

    Sai Yeluri.