HotKey

Hotkey is used to bind a key or a key combination to an client side or server side event via ajax. In first example use "left" and "right" keys to switch images and in second example you can do an ajax request with the (ctrl+shift+s) combination.

ImageSwitch Integration

Ajax Hotkey

Source

<h3>ImageSwitch Integration</h3>
<p:imageSwitch effect="fade" widgetVar="switcher" slideshowAuto="false">
    <p:graphicImage value="/images/nature1.jpg" />
    <p:graphicImage value="/images/nature2.jpg" />
    <p:graphicImage value="/images/nature3.jpg" />
    <p:graphicImage value="/images/nature4.jpg" />
</p:imageSwitch>

<p:hotkey bind="left" handler="PF('switcher').previous();" />
<p:hotkey bind="right" handler="PF('switcher').next();" />

<h3>Ajax Hotkey</h3>
<h:form>

    <p:hotkey bind="ctrl+shift+s" update="display" actionListener="#{hotkeyController.action}"/>

    <h:panelGrid columns="2" style="margin-bottom:10px">
        <h:outputLabel for="firstname" value="Firstname:" />
        <p:inputText id="firstname" value="#{pprBean.firstname}" />
    </h:panelGrid>

    <p:outputPanel id="display">
        <h:outputText value="Hello: #{pprBean.firstname}" rendered="#{not empty pprBean.firstname}"/>
    </p:outputPanel>

</h:form>