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 (Left-Right)

Ajax Hotkey (ctrl + shift + s)

<h3 style="margin-top:0">ImageSwitch Integration (Left-Right)</h3>
<p:imageSwitch effect="fade" widgetVar="switcher" slideshowAuto="false">
    <p:graphicImage name="demo/images/nature/nature1.jpg" />
    <p:graphicImage name="demo/images/nature/nature2.jpg" />
    <p:graphicImage name="demo/images/nature/nature3.jpg" />
    <p:graphicImage name="demo/images/nature/nature4.jpg" />

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

<h3>Ajax Hotkey (ctrl + shift + s)</h3>
    <p:growl id="msgs" showDetail="true" skipDetailIfEqualsSummary="true" />
    <p:hotkey bind="ctrl+shift+s" update="msgs" action="#{}"/>

    <h:panelGrid columns="2" cellpadding="5">
        <p:outputLabel for="text" value="Text" />
        <p:inputText id="text" value="#{hotkeyView.text}" />


Built-in component themes created by the PrimeFaces Theme Designer.

nova-light Nova-Light
nova-dark Nova-Dark
nova-colored Nova-Colored
luna-blue Luna-Blue
luna-amber Luna-Amber
luna-green Luna-Green
luna-pink Luna-Pink
omega Omega


Create awesome applications in no time using the premium templates and impress your users.