Jys<br /><a href="http://jy-s.com" target="_blank" rel="nofollow">http://jy-s.com</a><br /> <br />Trying my very best to learn java, please forgive me if i'm asking some really stupid questions.
Jys<br /><a href="http://jy-s.com" target="_blank" rel="nofollow">http://jy-s.com</a><br /> <br />Trying my very best to learn java, please forgive me if i'm asking some really stupid questions.
Cheers,
Joshua
Jolie Lee wrote:you can try body on~load calls a javascript method, then in the javascript method calls a commandbutton which is hidden. that commandbutton can then call a method in your backing bean.
function test(){
document.getElementById('formName:buttonId').click();
}
<body on~load="test();">
<h:commandButton action="#{backingBean.methodName}" id="buttonId" style="display: none"/>
</body>
Hi i am trying to use the function on body onload .its hitting more then once test();
Test function is called endless loop...
Thanks
kumar
Stefan Frings wrote: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().
Stefan Frings wrote: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().
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.
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|