How to Use Command Buttons and Command Links

Working with Navigation Components 18-7 ■ af:commandLink ■ af:commandImageLink ■ af:commandMenuItem stand-alone or within an af:menuBar component ■ af:commandNavigationItem if no value is specified for the destination attribute, the ADF Faces framework enables the browser context menu in the following scenarios: – For the two anchors that af:commandNavigationItem renders when inside an af:train component – When an af:commandNavigationItem renders inside an af:breadCrumbs component – When an af:commandNavigationItem renders inside an af:navigationPane component any hint--tabs, bar, buttons, choice, list ■ af:panelTabbed: the tabs and overflow indicators ■ af:panelAccordion: the disclosure link and overflow indicators You cannot configure this behavior for components that specify a destination and do not invoke an action. Examples of these components include the following: ■ af:goLink ■ af:goImageLink ■ af:commandNavigationItem where you specify a value for the destination attribute and no value for the action attribute

18.3.1 How to Configure a Browser’s Context Menu for Command Links

Set the value of the oracle.adf.view.rich.ACTION_LINK_BROWSER_CONTEXT_ SUPPRESSION context parameter in your application’s web.xml file to no. Before you begin: It may help to understand what command components you can configure this functionality for. For more information, Section 18.3, Configuring a Browser’s Context Menu for Command Links. To configure a browser’s context menu for a command link: 1. In the Application Navigator, double-click web.xml to open the file. By default, JDeveloper opens the web.xml file in the Overview editor. 2. In the Context Initialization Parameters table, add an entry for the oracle.adf.view.rich.ACTION_LINK_BROWSER_CONTEXT_SUPPRESSION parameter and set it to no. 3. Save and close the web.xml file.

18.3.2 What Happens When You Configure a Browser’s Context Menu for Command Links

If you followed the procedure outlined in Section 18.3, Configuring a Browser’s Context Menu for Command Links, JDeveloper writes a value to the web.xml file, as shown in Example 18–1 . 18-8 Web User Interface Developers Guide for Oracle Application Development Framework Example 18–1 Context Parameter to Configure a Browser’s Context Menu context-param param-nameoracle.adf.view.rich.ACTION_LINK_BROWSER_CONTEXT_SUPPRESSIONparam-name param-valuenoparam-value context-param For more information about ADF Faces configuration options in your application’s web.xml file, see Section A.2, Configuration in web.xml. At runtime, end users can invoke a browser’s context menu by right-clicking on the links rendered by certain components, as described in Section 18.3, Configuring a Browser’s Context Menu for Command Links.

18.4 Using Buttons or Links to Invoke Functionality

In addition to using command components for navigation, ADF Faces also includes listener tags that you can use in conjunction with command components to have specific functionality execute when the action event fires. Listener tags included with ADF Faces include: ■ exportCollectionActionListener: Use to export data from an ADF Faces application to an Excel spreadsheet. For more information, see Section 10.9, Exporting Data from Table, Tree, or Tree Table . ■ fileDownloadActionListener: Use to initiate a file download from the server to the local computer. For more information, see Section 18.4.1, How to Use a Command Component to Download Files . ■ resetActionListener: Use to reset submitted values. However, no data model states will be altered. For more information, see Section 18.4.2, How to Use a Command Component to Reset Input Fields . If you want to reset the input components to their previous state, which was partially or fully submitted successfully to the server, then you can use a reset button. For more information, see Section 9.2.3, How to Add a Reset Button to a Form .

18.4.1 How to Use a Command Component to Download Files

You can create a way for users to download files by creating an action component such as a command button and associating it with a fileDownloadActionListener tag. When the user selects or clicks the action component, a popup dialog is displayed that allows the user to select different download options, as shown in Figure 18–3 . Figure 18–3 File Download Dialog