Yahoo geocode taglib ver. 1.3


    JSP custom taglib lets you perform geocode requests via Yahoo Placefinder API. This service lets you find for example the specific latitude and longitude for an address. For example:
 


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

<g:YahooGeocode appid="your_id" result="res">
<g:setParameter name="location">701 First Street, Sunnyvale, CA</g:YahooGeocode>
</g:YahooGeocode>

<p>Found: <%=res.getFound()%> <%=res.getResult()[0].getLatitude()%> : <%=res.getResult()[0].getLongitude()%>

and you will get this:

Found:1 37.416386 : -122.02486

Attribute result describes a name for page scope variable with geocode data. Type for this variable is com.cj.yahoo.GeocodeBean. This bean supports the following methods:

getError()
getErrorMessage()
getLocale()
getQuality()
getFound()
getResult() - contains an array for results (com.cj.yahoo.GeocodeResultBean)

com.cj.yahoo.GeocodeResultBean supports the following methods

getLatitude()
getLongitude()
getQuality()
getStreet()
getCity()
getState()
getZip()
getCountry()

Tags are:

YahooGeocode

Body tag performs geocoding request via Yahoo PlaceFinder API. Attributes are:

1) appid Describes application ID (you have to request it from Yahoo).
2) url Optional attribute. Defines an URL for Yahoo API. Default value is http://where.yahooapis.com/geocode.
3) result Describes a name of your page scope variable (type is com.cj.yahoo.GeocodeBean) for data.

setParemeter

Body tag lets you set a parameter for geocode request. Tag's body describes a value. Attributes are:

1) name Describes a name for your parameter

for downloading:

Library: yahoogeocodetag.jar    Description: taglib.tld

© Coldbeans      Comments?

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

Also in Coldtags: