✎
编程开发网
首页
C语言
C++
面试
Linux
函数
Windows
数据库
下载
搜索
当前位置:
首页
->
AI编程基础
->
JAVA
struts2二级联动调用天气预报webservice服务在浏览器中显示天气情况(二)
2014-11-23 23:56:37
·
作者:
·
浏览:
1
标签:
struts2
二级
联动
调用
天气预报
webservice
服务
浏览器
显示
天气
情况
) { return cityParam; } public void setCityParam(String cityParam) { this.cityParam = cityParam; } public Map
getProvinceMap() { return provinceMap; } public void setProvinceMap(Map
provinceMap) { this.provinceMap = provinceMap; } public Map
getCityMap() { return cityMap; } public void setCityMap(Map
cityMap) { this.cityMap = cityMap; } public Map
getWeatherMap() { return weatherMap; } public void setWeatherMap(Map
weatherMap) { this.weatherMap = weatherMap; } }
4.页面代码
html;" http-equiv="content-type" /> <script type=text/java script src=http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js><script type=text/java script> $(function(){ $.ajax({ type: POST, url: weather!querySupportProvince.action, dataType: json, data: {}, success: function(data) { $.each(data.provinceMap,function(key,value) { $(#region :input:first).append(
+value+
); }); } }); $(#region :input:first).change(function() { $.ajax({ type: POST, url: weather!querySupportCity.action, dataType: json, data: {'provinceParam':$(#region :input:first).val()}, success: function(data) { $(#region :input:eq(1)).empty().append(
请选择
); $.each(data.cityMap,function(key,value) { $(#region :input:eq(1)).append(
+value+
); }); } }); }); $(#region :input:eq(1)).change(function() { $.ajax({ type: POST, url: weather!queryWeatherbyCityName.action, dataType: json, data: {'cityParam':$(#region :input:eq(1)).val()}, success: function(data) { $(div.weather).empty(); $.each(data.weatherMap,function(key,value) { if(key==beginTendencyJpg||key==beginTendencyJpg2||key==beginTendencyJpg3|| key==endTendencyJpg||key==endTendencyJpg2||key==endTendencyJpg3) { $(div.weather).append(
); } else { $(div.weather).append(
+value+
); } }); } }); }); });
地域:
请选择
请选择
最终效果图:
首页
上一页
1
2
下一页
尾页
2
/2/2