So I have an inputText that has its value hook to myBean.text, I want that if I click enter/return key, the inputText will invoke a method inside
The easiest way is to put the inputText in a form and hide a commandButton next to it.
For example:
UPDATE:
If you are using Seam you can use the tag. This makes that commandButton that contains it the one that responds to the ENTER.
If you aren't using Seam you could try one of the similar defaultAction controls
Or you could roll your own with a bit of Javascript; ideally jQuery. For example:
$('input.myText').keypress(function(e) {
if (e.which == 13) {
$('.myButton').click();
}
});