title: Setting OK(submit) button in JSF 2.0
body: <p>I have a form and two command buttons. I want that on pressing the enter key, the second commandButton is pressed, but the first commandButton is being pressed.</p>
  
  <p>Please consider the following sample code.</p>
  
  <pre><code>&lt;h:form&gt;
      &lt;p:inputtext value="#{bean.mobileNumber}" /&gt;
      &lt;p:commandButton id="startNewChat" value="Chat" action="#{bean.startNewChat}" update="chatWindow" /&gt;
      &lt;br /&gt;
      &lt;br /&gt;
  
      &lt;p:outputPanel id="chatWindow"&gt;
          &lt;p:inputTextarea readonly="true" value="#{bean.chatMessages}" /&gt;
          &lt;p:inputText value="#{bean.newChatMessageFromWeb}" /&gt;
          &lt;p:commandButton id="submitChatMessage" action="#{bean.submitChatMessage}" value="Send Message" /&gt;
      &lt;/p:outputPanel&gt;
  
  &lt;/h:form&gt;
  </code></pre>
  
  <p>When Enter key is pressed, first commandButton(with id="startNewChat") is pressed, but I want that second commandButton(with id="submitChatMessage") should be pressed.</p>
  
  <p><strong>What I have tried:</strong> accesskey="13", type="submit", id="submit"</p>