Google weather taglib ver. 1.1


    Custom JSP tags library lets you obtain weather information from Google service. E.g. the following URL requests weather data for Moscow. Taglib lets obtain XML data from Google, parse them and made them available for the application via plain JavaBean. For example:
 


<%@ taglib uri="taglib.tld" prefix="g" %>

<g:GWeather id="A">Moscow</g:GWeather>

<% java.util.Iterator it = A.iterator();
  while (it.hasNext()) {
  com.cj.gweather.GoogleWeatherBean gb = (com.cj.gweather.GoogleWeatherBean)it.next();
%>

  <br/><%=(gb.getDayOfWeek()!=null)?gb.getDayOfWeek():"Today"%> <%=gb.getConditionData()%>

<%
  }
%>

Taglib accepts a location (as tag's body or via attribute location) and creates ArrayList with data. The first element in this collection describes the current data, the following elements describes forecasts. JavaBean for data element provides the following methods:


getIcon() - describes an URL for icon
getConditionData() - describes a condition data
getHumidityData() - describes a humidity data
getWindCondition() - describes a wind condition
getDayOfWeek() - describes a day of week
getTempF() - describes a current temperature (Fahrenheit)
getTempC() - describes a current temperature (Celsius)
getLow() - describes a low temperature for forecasts
getHigh() - describes a high temperature for forecasts

Tags are:

GWeather

Body tag lets you collect weather data from Google. Tag's body describes a location. Attributes are:

1) location Optional attribute. Describes a location.
2) id Describes a name for the page scope variable (type is java.util.ArrayList) with data.

for downloading:

Library: gweathertag.jar    Description: taglib.tld

 © Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.

Also in Coldtags: