ADF Faces: commandbutton with keyboard “hotkeys” example using JQuery

This simple example will display a page with a button on it and when you hit the ‘F9’ key, an actionlistener is called on the backing bean. Javascript files should be placed under


JSF Code:

<af:document title=”hotkeystester.jsf” id=”d1″>
<af:resource type=”javascript” source=”/resources/js/jquery-1.6.2.min.js”/>
<af:resource type=”javascript” source=”/resources/js/hotkeys.js”/>
<af:form id=”f1″>
<af:commandButton text=”commandButton 1″ id=”cb1″ immediate=”true”

hotkeys.js code:

var F9_KEY_CONST = 120;

$(document).keydown(function(e) {

switch(e.keyCode) {
case F9_KEY_CONST:
var button = AdfPage.PAGE.findComponentByAbsoluteId(‘cb1’);
AdfActionEvent.queue(button, true);


BackingBean actionlistener:

public void testHotkeyEvent(ActionEvent actionEvent) {
// Add event code here…

About wesfang
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to ADF Faces: commandbutton with keyboard “hotkeys” example using JQuery

  1. nehsog says:

    This is really cool! Old Oracle Forms customers always ask for hot key support (“I want to use my F6 key to start search”). This could be an appropriate solution to those requests! Thank you!

    • wesfang says:

      We also develop with Oracle Forms! Our forms users love the keyboard as they perform heavy sets of data entry, this was one of the reasons why I experimented with this functionality. Thank you for reading.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s