DWR Real-time automatic dynamic update of Web page data

Source: Internet
Author: User

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 &nbsp;</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);
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.