I have a JSP with a button. This button is disabled. How can I make the JSP keep on reloading until isCheck becomes true and it will make the button enabled?

Here is my javascript:

var usbAvailable = <%=CheckUSB.getInstance().getStatus()%>;

function confirmSound(){
    HyPAS.Sound.confirm();
    HyPAS.LED.on();
    location.href='ScanJobServlet'
}

function checkUSB(){
    <%response.setHeader("Cache-Control","no-cache");%>
    if(usbAvailable==false)
        {
            document.getElementById('scan').disabled=true;
        }
    else
        {
            <% response.addHeader("Refresh","5"); %>
        }
}

Here is my JSP

<body onload="checkUSB()" bgcolor="#eeeeee" style='position:absolute;z-index:0;left:0;top:0;width:100%;height:100%; margin-left: 0px; margin-top: 0px; background-image: url("/scanToRemovableMemory/img/gra_scn_subL_sys.png"); background-repeat: no-repeat; height: 235px; width: 535px' onload="setInnerHTML()">
<div
    style="height: 278px; width: 432px; background-color: transparent; margin-left: 0px; margin-top: 0px;">

<div style="top: 35px; width: 231px; text-align: left; font-size: 25px; font-family: Albany; height: 33px; position: absolute"><p style="top: 125px; width: 501px; " align="center">Scan to Removable Memory</p></div><br>
<div style="width: 139px; height: 50px">
<input 
    id="scan"
    type="button" 
    value="SCAN"
        style='position: absolute; 
            left: 175px;
            top: 140px; 
            height: 48px; 
            width: 128px; 
            font-size: 16px; 
            font-family: Albany; background-image: url("/scanToRemovableMemory/img/cpt_func_007_i.png"); border-bottom-style: none; border-top-style: none; border-left-style: none; border-right-style: none'
    onfocus="this.blur()" 
    onclick="confirmSound()">
   </div>
</div>
<br>

</body>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.