weather.jsp
1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="weaver.hrm.*" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="java.net.URL" %>
<%
User user = HrmUserVarify.getUser (request , response) ;
if(user == null) return;
%>
<%
if(isConnect("https://tianqi.2345.com")){
%>
<iframe allowtransparency="true" frameborder="0" width="575" height="96" scrolling="no" src="https://tianqi.2345.com/plugin/widget/index.htm?s=2&z=3&t=0&v=0&d=5&bd=0&k=&f=000000&q=1&e=0&a=1&c=58362&w=575&h=96&align=center"></iframe>
<%}else{
%>
<script type="text/javascript">
if(window.name&&window.name!=''){
alert(window.name);
parent.document.getElementsByName(window.name)[0].height=0;
}
</script>
<%}
%>
<%!
private boolean isConnect(String url){
boolean flag = false;
int counts = 0;
if(null==url || url.length()<=0){
return flag;
}
while(counts<5){
try{
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
int state = connection.getResponseCode();
if(state == 200){
flag = true;
}
break;
}catch(Exception e){
counts++;
continue;
}
}
return flag;
}
%>