为页面添加天气显示的方法有很多,在本文为大家介绍下使用js来轻松实现,具体的代码如下,感兴趣的朋友不要错过
代码如下:
<%@ page language="java" pageEncoding="UTF-8"%>
天气情况
date.jsp
代码如下:
<%@ page language="java" import="java.net.*,java.io.*" pageEncoding="utf-8"%>
<%
String cid = request.getParameter("cid");
URL url = new URL(""+cid+".html");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.connect();
InputStream cin = httpConn.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(cin,"UTF-8"));
StringBuffer sb = new StringBuffer();
String rl = null;
while ((rl = reader.readLine()) != null)
sb.append(rl);
out.println(sb);
%>
阅读(1425) | 评论(0) | 转发(2) |