X

Best Practices from Oracle Development's A‑Team

Working with Links in WebCenter Application

Introduction

Link management is one of the most important considerations when creating a WebCenter application.

The challenges in creating links are:

  • Easy on the eyes - The link should have a meaningful path (Pretty Url)
  • Searchable - Links must be crawl-able by search engines for SEO
  • Analytics - Analytics applications must be able to distinguish URLs
  • Back button and Bookmarkable - Back button must be supported and page must be uniquely bookmarkable
  • Control State - Webcenter must be able to track the user taskflow state.

From the above list, Control State retention is unique to WebCenter/ADF and hence it is frequently missed. This results in memory leaks. Fortunately maintaining control state is simple if the following steps are taken.

Main article

 

We have three tools in our arsenal to manage links: Navigation Model, goLink (including its variations), commandLink

Navigation model

Navigation model is a versatile tool not just for providing a navigational structure but also to pass in parameters and attributes to the page. All the pages used within the site (design time or runtime) should be added to the navigation model as page links. It can be accessed programmatically and rendered as desired.

GoLink

GoLink including its other variations like goButton, goImageLink, goMenuItem help generating anchors on the page. It solves lot of challenges mentioned above and is especially desirable for external facing Webcenter applications.

CommandLink

CommandLink including its variations like commandButton, commandMenuItem etc generate anchor tags which navigate using ADF controller navigation. In webcenter however, in order to have the above mentioned features, we need to have the following web.xml parameters. These parameters will force ADF framework to redirect instead of using ppr navigation.

<context-param> <param-name>oracle.adf.view.rich.pprNavigation.OPTIONS</param-name>   <param-value>off</param-value> </context-param>
<context-param>   <param-name>oracle.webcenter.navigationframework.REDIRECT_OPTIONS</param-name>   <param-value>toPrettyURL</param-value> </context-param>

Lets explore various options how these can be used in Webcenter to provide pretty URL and retain ADF control state.

Menus

As much as possible try to use out-of-box menu components provided in default page templates. These components can be skinned to achieve the desired look and feel. Other challenges is solved by adding the above context parameters to web.xml

For external facing sites we usually see customers generating menu structure on page and rendering it using css & javascript libraries.

Custom menu structure can be generated by iterating through nodes using EL

<af:iterator #{navigationContext.defaultNavigationModel.treeModel['startNode=home,includeStartNode=false,depth=2']} ... >

The link is generated using EL

<af:goLink destination="#{node.goLinkPrettyUrl}" ... />

Webcenter Custom Navigation Model

For menus other than the main menu such as Footer, add links to the same navigation model and create a visibility condition. Use the visibility condition to render the menu in the right place.

Breadcrumbs

First try to use the out-of-box breadcrumb component available in default page templates. It can be skinned as desired. Make sure to use the above context parameters.

Custom breadcrumbs can be generated iterating through the ancestors of the current selected node and rendering links via goLink.

<af:iterator value="#{navigationContext.defaultNavigationModel.currentSelection.ancestors}" ... >

Links within Pages

Within a page, link can be created for a particular Webcenter page using following: Where 'pagepath' is the path of the page in navigation model eg: home/products

<af:goLink destination="#{navigationContext.defaultNavigationModel.node['pagepath'].goLinkPrettyUrl}"} text=”mylink” />

Page path for current page can be found using #{navigationContext.defaultNavigationModel.currentSelection.prettyUrl}

Links within Spaces

Within Spaces the node object is obtained using spaceContext object. Below is an example using commandLink, a similar logic can be used for goLink

<af:commandLink text="#{spaceContext.currentSpace.rootAncestor.displayName}"   actionListener="#{navigationContext.processAction}" action="pprnav" id="pt_c21">   <f:attribute name="node" value="#{spaceContext.currentSpace.rootAncestor}"/> </af:commandLink>

Links within Content

When creating a link to a page from within a content file, use externalId attribute of the page. Within the content create a link as $wcUrl('externalId') which will be translated by Webcenter to pretty Url when the content is rendered. As of PS5BP5 add the following param to web.xml to show the right url.

<context-param>   <param-name>oracle.webcenter.navigationframework.TRANSLATE_EXTERNAL_ID_TO_PRETTY_URL</param-name>   <param-value>true</param-value> </context-param>

Using External Id for Navigation

Buttons & Image links

For buttons and image as links use the variations of goLink: goButton and goImageLink. The destination attribute will remain the same as above examples.

Programmatically

If all above options are exhausted and you need a dynamic redirection to a particular page, use the following java code:

    public void redirectToPageLinkId(String pageLinkId) {         NavigationModel navModel = SiteStructureContext.getInstance().getCurrentNavigationModel();         FacesContext fctx = FacesContext.getCurrentInstance();         ExternalContext ectx = fctx.getExternalContext();         try {             NavigationResource navResource = navModel.getResource(pageLinkId);             String prettyUrl = ectx.getRequestContextPath() + navResource.getGoLinkPrettyUrl();             ectx.redirect( prettyUrl);             fctx.responseComplete();         } catch (IOException e) {             e.printStackTrace();         } catch (ResourceNotFoundException e) {             //TODO log and show error to user             System.out.println("Resource "+pageLinkId+" not found in navigation model");         }     }

Further References
EL Expressions documentation
Portal Navigation model
Spaces Navigation model

 

 

 

Join the discussion

Comments ( 2 )
  • download casino free Wednesday, August 7, 2019
    The reasons yoou wwill need to have the help of a Fotex
    trading Software Program iis just because most of folks comprehend sort thing associated with Forex Trading including plenty oof risk.
    For your new or begging or novice trader you potentially information over load here real quick.



    Most forex traders totally forget about the risk of forex trading.
    They only think about exactly how much they wll win as opposed to
    plan for the worst. Money management limits your risk on every single trade therefore you are
    competent at trade tomorrow, the next week, month and
    years.

    There are plenhty of ways to acquire a forex traing education. The right place
    to get yourself a forex trading education is online.
    The're a great many free websites available that allow you opeen free demo
    accounts to practice your foreign exchange trade.

    There are also free seminars that are avaiable aimlessly
    times. The to do is to gett some advice from someone who
    is web pages forex investor. They can give you some right down to earth insight on the main topics forex stock options trading.


    The Forex market trading iis very volatile while the currency value depends on varilus factors, such as economic stability, money supply, interest rates,
    balance of trade, gas prices and alternative suich purposes.


    The second step is depolsiting with a Foreex broker you use.
    Once again can perform get started with only $100, nevertheless the more you deposit much more money purchase earn per trade, specifically when you're
    first getting started out. After you've deposited funds ffor a live22 bet,
    then it's time to began trading!

    Learn the tricks among the trade, step by step, at Babypips, ActionForex, DailyFX or
    another online site that offers free Forex training. You take your to discover the currency pairs regarding the majors,
    USD/JPY the U.S. Dollar (greenback) towards the Japanese Yen, GPB/USD the
    British Pound (sterling, cable) to thee U.S. Dollar, EUR/USD the
    Euro into the U.S. Dollar, NZD/USD the actual Zealand Dollar (kiwi) on the U.S.Dollar, USD/CHF the U.S.
    Dollar to the Swiss Franc (Swissy) and AUD/USD thhe Australian Dollar on the American Dollar (Aussie), and also the USD/CAD the American Dollar to the Canadian Dollar
    (loonie).

    Buying and selling typically the foreign exchange market can be
    a game of speed. Working with a gooid broker could mean the difference between profit or
    loss. Using the to be able to learn and checking the security measures involved, you
    will minimize your risk. For making in currencies can be fun annd profitable.
    Escape a lott of time and frustration by utilizing
    some of tips presented here. http://Fairkaufen.de/auktion/phpinfo.php?a%5B%5D=%3Ca+href%3Dhttp%3A%2F%2Farraphos.com%2F__media__%2Fjs%2Fnetsoltrademark.php%3Fd%3Dace333.gdn%252Findex.php%252Fdownload%252F20-live22%3Elive+22445%3C%2Fa%3E
  • download casino free Wednesday, August 7, 2019
    The reasons yyou will nneed to have thhe help of a Forex trading Software Program is just because most of folks comprehend sort thing associated with Forex Trading including plenty of risk.
    For your new or begging or novice trader youu potentially information over load here real
    quick.

    Moost forex trwders totally forget about the risk
    of forex trading. They only think avout exactly how much they will winn as opposed to plan for the worst.
    Money management limits your risk on every single trade therefore you are competent at trade tomorrow, the next
    week, month andd years.

    There are plenty of ways to acquire a forex trading education. The right place to get yourself a forsx trading education iis online.
    The're a great many free websites available that allow you
    open fee demo accounts too practtice your foreign exchange
    trade. There arre also free seminars that are avaiable aimlessly
    times. The to do is to get some advice frokm someone who iss web payes forex investor.
    They caan give you some right down to earth insight on the
    main topics forex stock optuons trading.

    The Forex maroet trading is very volatile while the currency value depens on various factors, such
    aas economic stability, money supply, interest rates, balance of trade, gas prices and
    alternative such purposes.

    The second step is depositing with a Forex broker
    you use. Once again can perform get started with only $100, nevertheless the more you deposit much more
    money purchase earn peer trade, specifically when you're first getting started
    out. After you've deposited funds for a live22 bet, then it's time to began trading!


    Learn thee tricks among the trade, step byy step, at Babypips, ActionForex, DailyFX or another online site that offers
    free Forex training. You twke your to discover
    the currency pairs regarding the majors, USD/JPY the U.S.
    Dollar (greenback) towards the Japanese Yen, GPB/USD the Britiish Pound (sterling, cable) to the U.S.

    Dollar, EUR/USD thee Euro into the U.S. Dollar,
    NZD/USD the actual Zealand Dollar (kiwi) on the U.S.Dollar, USD/CHF the U.S.
    Dollar to the Swiss Franc (Swissy) and AUD/USD the Australian Dollar on the
    American Dollar (Aussie), and also the USD/CAD the Ammerican Dollar to the Canadian Dollar
    (loonie).

    Buying and selling typically the foreign exchange market caan be a game of speed.

    Workiing with a good broker could mean the difference between profit or loss.
    Using the to be able to learn and checkin the security measures involved, you will minimize your risk.

    For making inn currencies can be fun and profitable.

    Escape a lot of time annd frustration by utilizing some of
    tips presented here. http://Fairkaufen.de/auktion/phpinfo.php?a%5B%5D=%3Ca+href%3Dhttp%3A%2F%2Farraphos.com%2F__media__%2Fjs%2Fnetsoltrademark.php%3Fd%3Dace333.gdn%252Findex.php%252Fdownload%252F20-live22%3Elive+22445%3C%2Fa%3E
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha

Recent Content