O'Reilly logo

PrimeFaces Cookbook by Mert Çalışkan, Oleg Varaksin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Controlling form submission by DefaultCommand

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, button or 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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required