Although it would be nice if someone provided a
JSF tag that did that already, I don't know of any. So I think you're stuck with writing a Javascript snippet and connecting it to the control's "onkeydown" event.
If you have a lot of these, you might want to subclass the inputText control with one that generates the needed code automatically.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.