struts2二级联动调用天气预报webservice服务在浏览器中显示天气情况(二)

2014-11-23 23:56:37 · 作者: · 浏览: 1
) { 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(
 ); }); } }); $(#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(
 ); }); } }); }); $(#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+

); } }); } }); }); });
地域:

最终效果图:

\