The Enter key makes form submission so easy that users always tend to use it. The most intuitive way is that the user can enter some text or make some changes to the existing text and then hit the Enter key to submit the form. But what for command component will submit the form if we have more than one of them? Browsers, especially IE, behave differently here. The
DefaultCommand component solves this problem by normalizing the command (for example,
link) that submits the form when the Enter key is hit.
In this recipe, we will discuss
p:defaultCommand in detail. We will implement a
p:selectOneMenu for dynamic selection of the command button used for form submission when the Enter key is hit. ...