The hidden button does not work beause the action handler answers with a page, which is the same page in this case. So the page will get re-loaded and because the onload script clicks the button again, the page gets reloaded in an endless loop.
Sometimes the solution is so easy to oversee it:
This calls the init method when the page gets loaded.
If you use the older JSF 1.2 release, then write #{myBean.init} and name the method getInit().