Samuel Younge

Greenhorn
+ Follow
since Aug 26, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Samuel Younge

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().




***

I was able to get the above post to work but I ended up putting the call in between the <head> tags and modifying it slightly.
Section of my index.xhtml


Method in my Managed Bean Controller msbController.java

Notice the addition of parenthesis after the init method name.
Works like a champ thanks Stefan!

Also, some people may do fine just adding the code they want to execute on page load in the managed bean controller's constructor method.

Samuel
10 years ago
JSF