Conditional tags ver. 2.0

    Custom JSP taglib. Conditionally evaluate body of the tag.

IfParameterExists - evaluates and processes the body of this tag if the specified parameter is included into request. Otherwise, tag's body will be skipped.

IfParameterNotExists - evaluates and processes the body of this tag if the specified parameter does not included into request. Otherwise, tag's body will be skipped.

IfParameterEquals - evaluates and processes the body of this tag if the specified parameter included into request is equal to the specified value. Otherwise, tag's body will be skipped.

IfParameterNotEquals - evaluates and processes the body of this tag if the specified parameter included into request does not equal to the specified value. Otherwise, tag's body will be skipped.

IfObjectExists - evaluates and processes the body of this tag if the specified object is included into request, page, session or application scope. Otherwise, tag's body will be skipped.

IfObjectNotExists - evaluates and processes the body of this tag if the specified object does not included into request, page, session or application scope. Otherwise, tag's body will be skipped.

IfClassExists - evaluates and processes the body of this tag if the specified class exists. Otherwise, tag's body will be skipped.

IfClassNotExists - evaluates and processes the body of this tag if the specified class does not exist. Otherwise, tag's body will be skipped.

IfTrue - evaluates and processes the body of this tag if the specified expression is true.

IfNull (IfNotNull) - evaluates and processes the body of this tag if the specified expression is null (not null).

IfEmptyString (IfNotEmptyString) - evaluates and processes the body of this tag if the specified expression is empty (not empty) string.

IfSecure (IfNotSecure) - evaluates and processes the body of this tag if the request is secure (https) or not secure (http).

IfAcceptLanguage (IfNotAcceptLanguage) - evaluates and processes the body of this tag if the client accepts (does not accept) the given language.

For example:
 


<%@ taglib uri="taglib.tld" prefix="if" %>
<html>
<if:IfParameterEquals name="what" value="init">

   Evaluates this if request.getParameter("what") equals to "init"

</if:IfParameterEquals>
<br>
</html>

it is equal to:
 


<%
  if ("init".equals(request.getParameter("what")))
    {
%>

   <!-- your body is here -->

<%
   }
%>

Tags are:

IfParameterExists

evaluates the body of this tag if the specified parameter is included into request. Parameters are:

1) name. Name for request's parameter

IfParameterNotExists

evaluates the body of this tag if the specified parameter does not included into request. Parameters are:

1) name. Name for request's parameter

IfParameterEquals

evaluates the body of this tag if the specified parameter included into request equals to the specified value. Parameters are:

1) name. Name for request's parameter
2) value. Value to compare

IfParameterNotEquals

evaluates the body of this tag if the specified parameter included into request does not equal to the specified value. Parameters are:

1) name. Name for request's parameter
2) value. Value to compare

IfObjectExists

evaluates the body of this tag if the specified attribute is included into request, page, session or application scope. Parameters are:

1) name describes a name for attribute
2) scope Optional parameter. Possible values are page, request, session or application. Describes a scope for your search.
3) type Optional parameter. Describes a type for the searched object

IfObjectNotExists

evaluates the body of this tag if the specified attribute does not included into request, page, session or application scope. Parameters are:

1) name describes a name for attribute
2) scope Optional parameter. Possible values are page, request, session or application. Describes a scope for your search.
3) type Optional parameter. Describes a type for the searched object

IfClassExists

evaluates the body of this tag if the specified class exists. Parameters are:

1) name describes a name for your class

IfClassNotExists

evaluates the body of this tag if the specified class does not exist. Parameters are:

1) name describes a name for your class

IfTrue

evaluates the body of this tag if the specified expression is true. Parameters are:

1) cond boolean expression

IfAjax

evaluates the body of this tag if the request comes via Ajax. Parameters are: none

IfNotAjax

evaluates the body of this tag if the request does not come via Ajax. Parameters are: none

IfNull

evaluates the body of this tag if the specified expression is null. Parameters are:

1) cond describes an expression

IfNotNull

evaluates the body of this tag if the specified expression is not null. Parameters are:

1) cond describes an expression

IfEmptyString

evaluates the body of this tag if the specified expression is empty string. Parameters are:

1) cond describes an expression

IfNotEmptyString

evaluates the body of this tag if the specified expression is not empty string. Parameters are:

1) cond describes an expression

IfSecure

evaluates the body of this tag if the request is secure (https). Parameters are: none

IfNotSecure

evaluates the body of this tag if the request is not secure (http). Parameters are: none

IfAcceptLanguage

evaluates the body of this tag if the client accepts the given language. Parameters are:

1) lang describes a language (two letters ISO code)

IfNotAcceptLanguage

evaluates the body of this tag if the client does not accept the given language. Parameters are:

1) lang describes a language (two letters ISO code)

for downloading:

Library: iftags.jar    Description: taglib.tld

 © Coldbeans      Comments?

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

Also in Coldtags: