`

jsp页面定时刷新的方法

    博客分类:
  • java
阅读更多
1.利用Javascript对整个页面的刷新
function init(){
 
   var t=120; //定义刷新频率,单位:秒
   var t1 = t * 1000;
   window.setInterval("refreshY()",t1);-----这里的t1为毫秒
}
function refreshY()
  {
     document.forms[0].action=<select:link page="/sysmain.do?method=init_head" />;
  document.forms[0].submit(); 
  }

然后
<body onload="init()">

这样就可以达到对整个页面的刷新

2.利用
<%
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<meta http-equiv="refresh"   content="1;url=<%=basePath%>again.do?method=init"> 
也可以对页面的刷新 ----这里的1为秒
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics