Load balance taglib ver. 1.3

    Custom JSP taglib. This taglib lets you change in dynamic links for resources on your HTML pages. Suppose you have a site with heavy traffic. In order to unload your server you may decide to serve some requests from other boxes in your cluster. For example in your HTML page you can use this taglib for images:
 


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

<lb:img src="pic.gif" param="A" />

Here A describes a context parameter for your web application. Tag assumes that this parameter describes a list of available servers (comma separated). E.g. in your web.xml file you can have some like this:
 


<context-param>
<param-name>A</param-name>
<param-value>http://www1.host.com, http://www2.host.com</param-value>
</context-param>

and it this case tag img will use as a source http://www1.host.com/pic.gif or http://www2.host.com/pic.gif.

If context parameter A does not exist than tag will use src parameter "as is".

In other words this tag provides a load balance schema for your resources. This taglib supports load balanced equivalents for three HTML tags: img, href and form (you can rotate URL's for action parameter.)

Tags are:

img

Provides a load balanced replacement for HTML img tag. Parameters are:

1) src Describes source for image
2) param Optional parameter. Describes context parameter with the list of rotated URL's.
3) border Optional parameter. Describes border for image
4) width Optional parameter. Describes width for image.
5) height Optional parameter. Describes height for image.
6) encode Optional parameter. Possible values are true or false. If this value is true than URL for scr will be encoded. Default value is false.
7) class Optional parameter. Describes CSS class.
8) style Optional parameter. Describes CSS style.
9) alt Optional parameter. Describes an alternate text for your image.

link

Body tag. Provides a load balanced replacement for HTML <a href tag. Tag's body defines a link. Parameters are:

1) href Describes href parameter
2) param Optional parameter. Describes context parameter with the list of rotated URL's.
3) target Optional parameter. Describes target frame
4) title Optional parameter. Describes title (tooltip)
5) encode Optional parameter. Possible values are true or false. If this value is true than URL for href will be encoded. Default value is false.
6) class Optional parameter. Describes CSS class.
7) style Optional parameter. Describes CSS style.

form

Body tag. Provides a load balanced replacement for HTML form tag. Parameters are:

1) action Describes action parameter
2) param Optional parameter. Describes context parameter with the list of rotated URL's.
3) target Optional parameter. Describes target frame
4) name Optional parameter. Describes name for form
5) encode Optional parameter. Possible values are true or false. If this value is true than URL for action will be encoded. Default value is false.
6) onsubmit Optional parameter. Describes onsubmit clause.
7) method Optional parameter. Describes method for action.
8) enctype Optional parameter. Describes enctype parameter.

for downloading:

Library: lbalance.jar    Description: taglib.tld

© Coldbeans      Comments?

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

Also in Coldtags: