getdata.jsp
<%@ page contenttype= "text/html; charset=gb2312 "language=" java "import=" java.sql.* "errorpage=" "%>"
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> Real-time Dynamic Data acquisition </title>
<script type= "Text/javascript" src= ' dwr/engine.js ' ></script>
<script type= "Text/javascript" src= ' dwr/util.js ' ></script>
<script src= "Dwr/interface/allbmmclist.js" ></script>
<script language= "JavaScript" >
var current_html=null;
function GetResult ()
{
Allbmmclist.getresult (CREATELIST2); GetResult () is a method in the background Java program
}
function CreateList2 (data1)
{
Datahtml.innerhtml=data1;
alert (DATA1);
}
function Myshow ()
{
Timer = Window.setinterval ("GetResult ()", 2000);
}
</script>
<body onload= "myshow ()" >
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" >
<tr>
<TD id= "datahtml" > Data display </td>
</tr>
</table>
</body>
In fact, the use of DWR to get background data is very easy to achieve, but for how to set the browser dynamic refresh Access data is not very clear, according to the information on the Internet to find that the original this is simpler:
function Myshow ()
{
Timer = Window.setinterval ("GetResult ()", 2000);
}