比这篇新的文章:
Codee#2403
比这篇旧的文章: Codee#2401
作者: shush, 点击175次, 评论(0), 收藏者(0), , 打分:
所有评论,共0条:( 我也来说两句)
比这篇旧的文章: Codee#2401
Codee#2402
语言: Java Server Page, 标签: 无 2009/06/24发布 8个月前更新作者: shush, 点击175次, 评论(0), 收藏者(0), , 打分:
Java Server Page语言: Codee#2402
01 Index.jsp:
02 <!-- Ajax定时查找任务 -->
03 function refreshNotice()
04 {
05 //请求的地址
06 var url = 'refreshNotice.do';
07 //将refreshForm表单域的值转换为请求参数
08 //var params = Form.serialize('refreshForm');
09 var params="requestKey=<s:property value='requestKey'/>";
10 //创建Ajax.Request对象,对应于发送请求
11 var myAjax = new Ajax.Request(
12 url,
13 {
14 //请求方式:POST
15 method:'post',
16 //请求参数
17 parameters:params,
18 //指定回调函数
19 onComplete: processResponse,
20 //是否异步发送请求
21 asynchronous:true
22 });
23 return false;
24 }
25 function processResponse(request)
26 {
27 //$("taskList").innerHTML = request.responseText;
28 var jss = request.responseText;
29 //加载到 javascript 类中 string -> jsBean
30 var jsobj = eval('(' + jss + ')');
31 refreshTable(jsobj);
32 }
33
34 function refreshTable(obj){
35
36
37 //update realtime warn
38 var warn=obj.warnTemp;
39 if(warn!=null){
40 var warnLevel=warn["warnLevel"];
41 if(warn["dealIndex"]==0&&warn["warnMsg"]!=null&&warn["warnMsg"]!=""){
42 var msg="["+warn["warnMsg"]+"] ";
43 if(warnLevel==1){
44 $('warnColor').style.color="lightblue";
45 $("generalLamp").src="imge/lan.gif";
46 $("secondaryLamp").src="imge/hui.gif";
47 $("importantLamp").src="imge/hui.gif";
48 $("seriousLamp").src="imge/hui.gif";
49
50 msg="一般告警"+msg;
51 }
52 if(warnLevel==2){
53 $('warnColor').style.color="yellow";
54 $("secondaryLamp").src="imge/huang.gif";
55 $("generalLamp").src="imge/hui.gif";
56 $("importantLamp").src="imge/hui.gif";
57 $("seriousLamp").src="imge/hui.gif";
58 msg="次要告警"+msg;
59 }
60 if(warnLevel==3){
61 $('warnColor').style.color="orange";
62 $("importantLamp").src="imge/ju.gif";
63 $("generalLamp").src="imge/hui.gif";
64 $("secondaryLamp").src="imge/hui.gif";
65 $("seriousLamp").src="imge/hui.gif";
66 msg="重要告警"+msg;
67 }
68 if(warnLevel==4){
69 $('warnColor').style.color="red";
70 $("seriousLamp").src="imge/hong.gif";
71 $("generalLamp").src="imge/hui.gif";
72 $("secondaryLamp").src="imge/hui.gif";
73 $("importantLamp").src="imge/hui.gif";
74 msg="严重告警"+msg;
75 }
76 $('warnColor').innerHTML=msg;
77 }
78 }else{
79 $('warnColor').innerHTML="";
80 $("generalLamp").src="imge/hui.gif";
81 $("secondaryLamp").src="imge/hui.gif";
82 $("importantLamp").src="imge/hui.gif";
83 $("seriousLamp").src="imge/hui.gif";
84 }
85
86 //update post message.
87 var notice=obj.messageNotice;
88 $('noticeId').innerHTML=notice["id"];
89 $('noticeContent').innerHTML=notice["content"];
90 var content=$('noticeContent').innerHTML;
91 content=content.trim();
92 //alert(content);
93 if(content!=null&&content!=''&&content!='null'){
94 $('msgBox').style.visibility='';
95 }
96 }
02 <!-- Ajax定时查找任务 -->
03 function refreshNotice()
04 {
05 //请求的地址
06 var url = 'refreshNotice.do';
07 //将refreshForm表单域的值转换为请求参数
08 //var params = Form.serialize('refreshForm');
09 var params="requestKey=<s:property value='requestKey'/>";
10 //创建Ajax.Request对象,对应于发送请求
11 var myAjax = new Ajax.Request(
12 url,
13 {
14 //请求方式:POST
15 method:'post',
16 //请求参数
17 parameters:params,
18 //指定回调函数
19 onComplete: processResponse,
20 //是否异步发送请求
21 asynchronous:true
22 });
23 return false;
24 }
25 function processResponse(request)
26 {
27 //$("taskList").innerHTML = request.responseText;
28 var jss = request.responseText;
29 //加载到 javascript 类中 string -> jsBean
30 var jsobj = eval('(' + jss + ')');
31 refreshTable(jsobj);
32 }
33
34 function refreshTable(obj){
35
36
37 //update realtime warn
38 var warn=obj.warnTemp;
39 if(warn!=null){
40 var warnLevel=warn["warnLevel"];
41 if(warn["dealIndex"]==0&&warn["warnMsg"]!=null&&warn["warnMsg"]!=""){
42 var msg="["+warn["warnMsg"]+"] ";
43 if(warnLevel==1){
44 $('warnColor').style.color="lightblue";
45 $("generalLamp").src="imge/lan.gif";
46 $("secondaryLamp").src="imge/hui.gif";
47 $("importantLamp").src="imge/hui.gif";
48 $("seriousLamp").src="imge/hui.gif";
49
50 msg="一般告警"+msg;
51 }
52 if(warnLevel==2){
53 $('warnColor').style.color="yellow";
54 $("secondaryLamp").src="imge/huang.gif";
55 $("generalLamp").src="imge/hui.gif";
56 $("importantLamp").src="imge/hui.gif";
57 $("seriousLamp").src="imge/hui.gif";
58 msg="次要告警"+msg;
59 }
60 if(warnLevel==3){
61 $('warnColor').style.color="orange";
62 $("importantLamp").src="imge/ju.gif";
63 $("generalLamp").src="imge/hui.gif";
64 $("secondaryLamp").src="imge/hui.gif";
65 $("seriousLamp").src="imge/hui.gif";
66 msg="重要告警"+msg;
67 }
68 if(warnLevel==4){
69 $('warnColor').style.color="red";
70 $("seriousLamp").src="imge/hong.gif";
71 $("generalLamp").src="imge/hui.gif";
72 $("secondaryLamp").src="imge/hui.gif";
73 $("importantLamp").src="imge/hui.gif";
74 msg="严重告警"+msg;
75 }
76 $('warnColor').innerHTML=msg;
77 }
78 }else{
79 $('warnColor').innerHTML="";
80 $("generalLamp").src="imge/hui.gif";
81 $("secondaryLamp").src="imge/hui.gif";
82 $("importantLamp").src="imge/hui.gif";
83 $("seriousLamp").src="imge/hui.gif";
84 }
85
86 //update post message.
87 var notice=obj.messageNotice;
88 $('noticeId').innerHTML=notice["id"];
89 $('noticeContent').innerHTML=notice["content"];
90 var content=$('noticeContent').innerHTML;
91 content=content.trim();
92 //alert(content);
93 if(content!=null&&content!=''&&content!='null'){
94 $('msgBox').style.visibility='';
95 }
96 }
所有评论,共0条:( 我也来说两句)
代码
