ECB currency rates taglib ver. 1.3

    Custom JSP taglib lets you request currency rates from ECB. The reference rates are based on the regular daily concentration procedure between central banks within and outside the European System of Central Banks, which normally takes place at 2.15 p.m. ECB time (CET). For example:
 


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

<r:GetECBRates result="A"/>

You car request historical rates (for the last 90 days). The attribute date sets date in format yyyy-mm-dd:
 


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

<r:GetECBRates date="2014-06-25" result="A"/>

Tag GetECBRates creates a page scope variable with results. And now you can examine your results:
 



Time is <r:GetECBRatesTime result="A"/>
RUB:<r:GetECBRate result="A" currency="RUB"/>
USD:<r:GetECBRate result="A" currency="USD" id="B"/> <%=B%>

and you will get some like this:

Time is 2006-01-10 RUB:34.3800 USD:1.2064

Tag ForEachRate lets you iterate over returned data:
 


<r:ForEachRate result="A" id="var">
 <br><%=var.getCurrency()%> : <%=var.getRate()%>
</r:ForEachRate>

The nested page scope variable described by the attribute id lets you request the following properties:

String getCurrency() - returns a name
double getRate() - returns a rate.

So you will get some like this:

BGN : 1.9559
LTL : 3.4528
GBP : 0.6833
ISK : 73.92
PHP : 63.523
EEK : 15.6466
CHF : 1.5437
CZK : 28.8
USD : 1.2064

etc.

Tags are:

GetECBRates

Body tag lets you perform a search via Google API. Parameters are:

1) result Describes a name for your page scope variable that will keep the results.
2) date Optional parameter. Describes a date in yyyy-mm-dd format.
2) proxyHost Optional parameter. Describes a proxy setting for HTTP requests.
3) proxyPort Optional parameter. Describes a proxy setting for HTTP requests.

ForEachRate

Body tag lets you iterate over returned data. Parameters are:

1) result Describes a name for your page scope variable that keeps the results.
2) id Describes a name for your page scope variable that will keep a reference to the current record.

GetECBRatesTime

Tag lets you request a time. Parameters are:

1) result Describes your variable with requested results.
2) id Optional parameter. Describes a name for your page scope variable that will keep the data (type is java.lang.String). Without this attribute tag simply prints data.

GetECBRate

Tag lets you request a rate for the given currency. Parameters are:

1) result Describes your variable with requested results.
2) currecy Describes a name for your currency.
3) id Optional parameter. Describes a name for your page scope variable that will keep the data (type is java.lang.Double). Without this attribute tag simply prints data.
 

for downloading:

 Library: ecbratestag.jar     Description: taglib.tld  

 © Coldbeans      Comments?

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

Also in Coldtags: