Keywords taglib ver. 1.2

    Custom JSP taglib lets you extract the keywords contained in the HTTP Referrer header provided by the web browser when a client comes to your site from a search engine query. So you can provide for example a special content for such users, tune your advertising etc. Body tag isFromSearchEngine executes own body if client comes from a search engine site. For example:
 


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

<s:isFromSearchEngine>
  <br>Search engine is: <%=engine%>
  <br>Keywords: <%=keywords%>
</s:isFromSearchEngine>

Body tag forEachKeyword lets you iterate over the presented keywords. For example:
 


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

<s:isFromSearchEngine>
  <br>Search engine is: <%=engine%>
  <s:forEachKeyWord>
   <br>keyword is: <%=keyword%>
  </s:forEachKeyWord>
</s:isFromSearchEngine>

Taglib uses an external text file (in XML format) engines.xml with definition for search engines attributes. You can download a sample for this file (described the most popular search engines) right from this page. Keep this file in your WEB-INF/lib directory. And of course you can add your own definitions to this file.

Tags are:

isFromSearchEngine

Body tag executes own body if your client comes from a search engine. Parameters are:

1) name Optional parameter. Describes a name for the nested page scope variable (type is java.lang.String) contained search engine's name. Default value is engine.
2) keywords Optional parameter. Describes a name for the nested page scope variable (type is java.lang.String) contained search engine's keywords. Default value is keywords.

forEachKeyWord

Body tag executes own body for the each detected keyword. Parameters are:

2) keyword Optional parameter. Describes a name for the nested page scope variable (type is java.lang.String) contained a current keyword. Default value is keyword.

for downloading:

Library: keywordstag.jar    Description: taglib.tld   Search Engines: engines.xml

© Coldbeans      Comments?

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