<h:commandLink action="" value="" onclick="alert('hey, I'm working')"/>
But if you write this JS-Code in all your commandLinks this breaks the DRY-Principle
I am also interested in custom components. If this is possible, please give us a hint.
I do not think you need custom component there. If you in a JSF 2 world you could just create behavior. And in JSF 1.2 - create custom facelet and re-use across all the pages. Or just attach your handler using jQuery to all the links on the page