Ad rotator tag ver. 1.7


    Custom JSP tag. Lets you display advertising banners (images). Tag AdRotator displays rotated banners (or images). .NET developers are familiar with AdRotator control. This tag provides the similar functionality (but with some additional features). It is a complete advertising management support for your JSP (and/or Coldfusion) pages. How to use it:

At the first hand create a text file describes your banners (images). File must be so called Properties file (ini-file for Windows developers). Properties must have the following form (data are case sensitive):

img.number.attribute=some_value

where:

img - reserved word
number - some integer (1,2, ...) number describes a sequential number for banner (image)
attribute - one of the following reserved words for attributes: ImageUrl,NavigateUrl, AlternateText,Impressions,Keyword

attributes are:

ImageUrl - contains the URL of the image to be displayed, it could be absolute or relative.
NavigateUrl - Optional parameter. Contains the URL of the target Web site.
AlternateText - Optional parameter. Contains the text that is to be displayed as a tooltip when mouse is over the image. In other words, this is the text for the ALT element in your image.
Keyword - Optional parameter. Contains the category to which the ad (image) belongs to. This lets the ads for all categories to be in the same data file and you will be able to filter images on given pages
Impressions - Optional parameter. This integer value indicates the relative weighting for the ad (image). Default value is 1.

so for example img.1.ImageUrl, img.1.NavigateUrl etc. describes your first banner, img.2.ImageUrl,img.2.AlternateText etc. describes your second banner etc.

More about impressions. If you will set for example:
img.1.Impressions=1
and
img.2.Impressions=2
it means that the second image will be displayed two times more often. By default all weights are equal.

Here is an example for data file:
 

# image 1
img.1.ImageUrl=http://host/pictures/pic.gif
img.1.NavigateUrl=http://www.acme.com
img.1.AltenateText=Acme's banner
img.1.Keywords=sell,buy,gift

# image 2
img.2.ImageUrl=/images/img.jpg
img.2.NavigateUrl=/part1/page.jsp
img.2.Impressions=5

# image 3
etc.

Notes:
1. Reserved words are similar to those from .NET control AdRotator
2. AdRotator control in .NET uses XML file for data description. Tag AdRotator uses Properties file (such files will be loaded and parsed much more quickly).

Path to your data file will be used as an attribute for AdRotator tag:
 


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

<ad:AdRotator adfile="your_data_file"/>

and you may set of course some additional parameters. E.g.:

<ad:AdRotator adfile="banners.txt" width="125" height="125"
   target="frame1" filter="buy,sell"/>

Tags are:

AdRotator

Displays rotated banners (images). Parameters are:

1) adfile data file. Path to file should be described relatively to the root of your web application.
2) width Optional parameter. Describes width of image in pixels. Default value is 468
3) height Optional parameter. Describes height of image in pixels. Default value is 60
4) borderwidth Optional parameter. Describes width of border for image. Default value is 0
5) bordercolor Optional parameter. Describes color for border. Default value is #000000 (black)
6) target Optional parameter. Describes target frame.
7) useContext Optional parameter. Possible values are true and false. If this value is true tag will add context part from the request to the all URLs from your adfile. So you will be able to use the same adfile in several web applications. Default value is false (use URLs as is).
8) filter Optional parameter. Describes keywords for images (comma separated). Comma here equals to the logical AND. So if you set for example filter to word1,word2 tag will show banners where both words are in Keyword attribute.
9) scope Optional parameter. Describes scope for rotation. Possible values are application or session. In the first case it will be just one loop for all users, otherwise it will be a separate loop for the each user. Default value is application.
10) writeAlternate Optional parameter. Possible values are true or false. If this value is true alternate text will be shown below the image. Default value is false.

Note: the evaluation version supports up to 3 images.

for downloading:

Library: adrotate.jar    Description: taglib.tld

 © Coldbeans Software      Comments?

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

Also in Coldtags: