The "struts-logic-el" tag library contains tags that are useful in managing conditional generation of output text, looping over object collections for repetitive generation of output text, and application flow management.


[Introduction] [Logic-EL Functionality] [Logic-EL Examples]

Introduction

The functionality of this tag library is entirely provided by the base "struts-logic" tag library in the Struts distribution. This derived tag library, "struts-logic-el", only provides a different way to evaluate attribute values, which is using the JavaServer Pages Standard Tag Library expression language engine, or the "JSTL EL" for short.

In general, the tags provided in the "struts-logic-el" library are a direct mapping from the "struts-logic" tag library. However, there are several tags in the base Struts tag library which were not "ported" to the "struts-logic-el" tag library, as it was determined that all of their functionality was provided by the JSTL. Information about these "non-ported" tags is provided in the information for the "org.apache.strutsel" package.

In addition, specific to the "struts-logic-el" library, two tags in this library have one additional attribute over their counterpart in the base Struts tag library. These tags are the match and notMatch tags, and the additional attribute is named expr, which is a value intended to be evaluated by the JSTL EL engine. More details about these tags and their attributes is provided in more detailed documentation about the package and its tags.

Logic-EL Functionality

The functionality of the "logic-el" tags can be almost entirely understood from the documentation of the "struts-logic" base tag library. The only exception is the new attribute added to the match and notMatch tags, being the expr attribute.

The match and notMatch tags provide the ability to check to see whether a specific value is (or is not) a substring of a value obtained from either a cookie, request header, request parameter, or bean property. The addition of the expr attribute allows the obtained value to come from an arbitrary expression language value.

Logic-EL Examples

The following are discrete examples of uses of the "logic-el" tags, in no paticular order, but emphasizing the use of JSTL EL values as attribute values.

Example:

    <logic-el:forward name="${forwardName}"/>

Example:

    <%-- Iterates through all HTTP headers. --%>
    <logic-el:iterate id="item" collection="${header}">
    <tr>
    <td><c:out value="${item}.key"/></td>
    <td><c:out value="${item}.value"/></td>
    </tr>
    </logic-el:iterate>

Example:

    <logic-el:match cookie="${cookieName}" value="${cookieValue}">
    Match succeeded.
    </logic-el:match>

Example:

    <logic-el:match expr='${hash["foo"]}' value="${matchValue}">
    Match succeeded.
    </logic-el:match>

Example:

    <logic-el:messagesPresent property="${messageKey}">
    Message found.
    </logic-el:messagesPresent>

Example:

    <logic-el:redirect href="http://localhost:${portnum}/factory" />