The EL code in your onclick attribute is evaluated at RENDER time, not when the client clicks on the button.
JSF backing beans are Models, not Controllers.
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.