title: Catch KeyCode in AjaxBehaviorEvent of JSF 2
body: <p>I have a JSF ajax keyup event linked to an event listner in a backing bean.</p>
  
  <p>The code in the JSF file is like below.</p>
  
  <pre><code>&lt;h:inputText id="txtDescription" value="#{institutionController.current.description}" disabled="#{institutionController.modifyControlDisable}" &gt;
      &lt;f:ajax event="keyup" listener="#{institutionController.changeDetailsEvent}" /&gt;
  &lt;/h:inputText&gt;
  </code></pre>
  
  <p>The code in the backing bean is like below.</p>
  
  <pre><code>public void changeDetailsEvent(AjaxBehaviorEvent event) {
  }
  </code></pre>
  
  <p>I want to achieve different logic depending on the key presses, like shown is pseudocode below.</p>
  
  <pre><code>public void changeDetailsEvent(AjaxBehaviorEvent event) {
      If (event.key = Key.enter) {
          do something;
      } else if (event.key = Key.Escape) {
          so something else;
      } else {
          do nothing;
      }
  
  }
  </code></pre>
  
  <p>Can someone please tell me how this is done in the backing bean?</p>