<%@ page language="java" contentType="text/html; charset=GBK"
pageEncoding="GBK"%>
<%@ include file="/common/taglibs.jsp" %>
<head>
<script>
var xmlHR;
function createXMLHttpRequest()//创建XmlHttpRequest对象
{
if(window.ActiveXObject)
{
xmlHR=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
xmlHR=new XMLHttpRequest();
}
return xmlHR;
}
function clearDoc()//清除body内容
{
document.body.removeChild(document.getElementsByTagName("div")[0]);
}
function callback(data)//回调函数
{
if(xmlHR.readyState==4)
{
if(xmlHR.status==200)
{
try{
clearDoc();
document.body.innerHTML=xmlHR.responseText; //设置body内容为响应回的网页
}
catch(ex)
{
alert(ex.name+" "+ex.number+" "+ex.description);
}
}
}
}
function refrushStatus()//发送请求到服务器
{
createXMLHttpRequest();
xmlHR.onreadystatechange=callback;
var url="${base}/job/delayList.action";
xmlHR.open("POST",url,true);
xmlHR.setRequestHeader("Content-Type","appliction/x-www-form-urlencoded");
xmlHR.send(null);
}
window.setInterval(refrushStatus,60*1000);//周期性发送请求
window.ondeactivate=function clear(){window.clearInterval(cb);} //离开则清除周期
</script>
</head>
<body><div>
当前执行作业:<br>
<table>
<thead>
<td>作业名</td>
<td>作业组</td>
<td>作业类型</td>
<td>执行命令</td>
<td>状态</td>
<td>开始时间</td>
</thead>
<tbody>
<c:forEach var="job" items="${delayLists}">
<tr>
<td><a href="#">${job.name }</a></td>
<td>${job.jobgroup}</td>
<td>${job.type}</td>
<td>${job.command}
</td>
<td>
<c:choose>
<c:when test="${job.result == -2}">
<font color=red>超时</font>
</c:when>
<c:when test="${job.result == -1}">
<font color=red>异常</font>
</c:when>
<c:when test="${job.result == 0}">
成功
</c:when>
<c:when test="${job.result == 1}">
<font color=red>失败</font>
</c:when>
<c:otherwise>
<font color=green>正在执行</font>
</c:otherwise>
</c:choose>
</td>
<td>${job.occurtime}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</body>