Multiple ajax calls to generate random numbers on a JSF facelets page using Javascript
===

I am new to Ajax and i am trying to generate random numbers continuously while the page loads. This is a Proof of concept that i am trying to achieve before start working on a business requirement. I have an output text which displays the generated random numbers by calling the backing bean. I want the backing bean's getRandomNumberInt() to be called continuously so that i see the random numbers getting changed on the page.

Please help!
    
Below is the code snippet.
    
**AjaxPage.xhtml**
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
    
    <div xmlns:f="http://java.sun.com/jsf/core"
    	xmlns:ui="http://java.sun.com/jsf/facelets"
    	xmlns:c="http://java.sun.com/jstl/core"
    	xmlns:h="http://java.sun.com/jsf/html"
    	xmlns:hx="http://www.ibm.com/jsf/html_extended">
    <hx:scriptCollector id="scriptCollector1">
    	<h:form styleClass="form" id="form1">
    
    		<h:panelGroup styleClass="panelGroup" id="randomNumberGroup">
    			<h:outputText styleClass="outputText" id="randomNumber"
    				value="#{pc_AjaxEnabledPOCView.randomNumberInt}"></h:outputText>
    		</h:panelGroup>
    		<hx:ajaxRefreshRequest target="randomNumberGroup"
    			id="ajaxRefreshRequest1">
    		</hx:ajaxRefreshRequest>
    
    		<h:outputLink id="outPutLinkMoreRandomNumber">
    			<h:outputText id="randomNumberOutputTextId"
    				value="Fetch more Random Number">
    			</h:outputText>
    			<hx:behavior event="onload" id="behavior1" behaviorAction="get"
    				targetAction="randomNumberGroup"></hx:behavior>
    		</h:outputLink>
    
    	</h:form>
    </hx:scriptCollector></div>
    
    
**AjaxEnabledPOCView.java** - Backing bean
    
    public class AjaxEnabledPOCView extends PageCodeBase {
    	private double randomNumberInt = 0;
    
    	public double getRandomNumberInt() {
    		randomNumberInt = randomNumberInt + Math.random();
    		System.err.println("Random Number: -" + randomNumberInt);
    		return randomNumberInt++;
    	}
    
    	public void setRandomNumberInt(double randomNumberInt) {
    		this.randomNumberInt = randomNumberInt;
    	}
    
    }


