在JSP中加入以下代码
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String url = basePath+"login.jsp"; //设置跳转的地址
%>
<html>
<head>
<meta http-equiv=refresh content=5;url=<%=url %>>
</head>
<body >
<b style=color:blue><span id=jump>5</span> 秒钟后页面将自动返回登录页面...</b>
</body>
</html>
<script>
function countDown(secs){
jump.innerText=secs;
if(--secs>0)
setTimeout("countDown("+secs+" )",1000);
}
countDown(5);
</script>