Referer taglib ver. 1.4

    Custom JSP tag. Evaluates and processes own body if the specified referer field matches to the given criteria. As a referer field you may use client's IP address, an URL for the page from which client's request was redirected to your JSP page (referer), User-Agent info and Accept header.

So, this tag will be useful when you need to add support for advertising, personalization or security in your JSP pages.

For example:

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

<!-- disable access from the specified IP address -->
<if:Referer field="ip" pattern="">
   <% return; %>

When you describe your criteria, you may use metasymbol * which will match to any substring. For example:

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

<!-- some special procedure for all requests from Google -->
<if:Referer field="url" pattern="*">
   <% out.println("Google is a cool search engine!"); %>

<!-- do something for MS IE browser -->
<if:Referer field="agent" pattern="*MSIE*">
   <% out.println("Your browser is MS IE!"); %>

<!-- do something for mobiles with WAP/WML -->
<if:Referer field="accept" pattern="*wap.wml*">
   <% out.println("User with mobile!"); %>

<!-- disable access for bots -->
<if:Referer field="agent" pattern="*bot*">
   <% return; %>

Tags are:


Evaluates own body in case of referer field matches to the given pattern. Parameters are:

1) field Optional parameter. Describes referer field. Possible values are ip, url, agent, accept. Default value is url.
2) pattern match criteria.

for downloading:

    Library: reftag.jar    Description: taglib.tld

© Coldbeans      Comments?

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


Also in Coldtags: