auto refresh of jsp page
Posted by: Krishna Pothula on January 19, 2006 in response to Message #196243
You can use the following JS function. All you have to do is write a Servlet that writes the Counter value to the response.
Pass the Servlet url to this function and fill it in a DIV or an Input field.
<code>
function readContent(urltoRead){
var counter = "";
try {
var xmlHttp = null;
try {
xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP" );
} catch (e) {
xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );
}
xmlHttp.open( "GET", urltoRead, false );
// Execute the request
xmlHttp.send(null);
if(xmlHttp.status == 200)
counter = xmlHttp.ResponseText;
else
counter = "Unknown";
} catch(errmsg) {
counter = "Unknown Counter";
}
}
</code>
No comments:
Post a Comment