You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2006/02/10 22:02:04 UTC

svn commit: r376842 [2/2] - /struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/

Modified: struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/PresentTag.java
URL: http://svn.apache.org/viewcvs/struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/PresentTag.java?rev=376842&r1=376841&r2=376842&view=diff
==============================================================================
--- struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/PresentTag.java (original)
+++ struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/PresentTag.java Fri Feb 10 13:02:03 2006
@@ -1,140 +1,143 @@
 /*
- * $Id$ 
+ * $Id$
  *
  * Copyright 2000-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.taglib.logic;
 
-import java.security.Principal;
-import java.util.StringTokenizer;
+import org.apache.struts.taglib.TagUtils;
 
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.jsp.JspException;
 
-import org.apache.struts.taglib.TagUtils;
+import java.security.Principal;
+
+import java.util.StringTokenizer;
 
 /**
- * Evalute the nested body content of this tag if the specified value
- * is present for this request.
+ * Evalute the nested body content of this tag if the specified value is
+ * present for this request.
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2004-10-16 12:38:42 -0400 (Sat, 16 Oct 2004)
+ *          $
  */
 public class PresentTag extends ConditionalTagBase {
-
-
     public static final String ROLE_DELIMITER = ",";
-    
-    // ------------------------------------------------------ Protected Methods
 
+    // ------------------------------------------------------ Protected Methods
 
     /**
-     * Evaluate the condition that is being tested by this particular tag,
-     * and return <code>true</code> if the nested body content of this tag
-     * should be evaluated, or <code>false</code> if it should be skipped.
-     * This method must be implemented by concrete subclasses.
+     * Evaluate the condition that is being tested by this particular tag, and
+     * return <code>true</code> if the nested body content of this tag should
+     * be evaluated, or <code>false</code> if it should be skipped. This
+     * method must be implemented by concrete subclasses.
      *
-     * @exception JspException if a JSP exception occurs
+     * @throws JspException if a JSP exception occurs
      */
-    protected boolean condition() throws JspException {
-
+    protected boolean condition()
+        throws JspException {
         return (condition(true));
-
     }
 
-
     /**
-     * Evaluate the condition that is being tested by this particular tag,
-     * and return <code>true</code> if the nested body content of this tag
-     * should be evaluated, or <code>false</code> if it should be skipped.
-     * This method must be implemented by concrete subclasses.
+     * Evaluate the condition that is being tested by this particular tag, and
+     * return <code>true</code> if the nested body content of this tag should
+     * be evaluated, or <code>false</code> if it should be skipped. This
+     * method must be implemented by concrete subclasses.
      *
      * @param desired Desired outcome for a true result
-     *
-     * @exception JspException if a JSP exception occurs
+     * @throws JspException if a JSP exception occurs
      */
-    protected boolean condition(boolean desired) throws JspException {
+    protected boolean condition(boolean desired)
+        throws JspException {
         // Evaluate the presence of the specified value
         boolean present = false;
-        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
-        
+        HttpServletRequest request =
+            (HttpServletRequest) pageContext.getRequest();
+
         if (cookie != null) {
             present = this.isCookiePresent(request);
-            
         } else if (header != null) {
             String value = request.getHeader(header);
+
             present = (value != null);
-            
         } else if (name != null) {
             present = this.isBeanPresent();
-            
         } else if (parameter != null) {
             String value = request.getParameter(parameter);
+
             present = (value != null);
-            
         } else if (role != null) {
-            StringTokenizer st = new StringTokenizer(role, ROLE_DELIMITER, false);
+            StringTokenizer st =
+                new StringTokenizer(role, ROLE_DELIMITER, false);
+
             while (!present && st.hasMoreTokens()) {
                 present = request.isUserInRole(st.nextToken());
             }
-            
         } else if (user != null) {
             Principal principal = request.getUserPrincipal();
+
             present = (principal != null) && user.equals(principal.getName());
-            
         } else {
-            JspException e = new JspException
-                (messages.getMessage("logic.selector"));
+            JspException e =
+                new JspException(messages.getMessage("logic.selector"));
+
             TagUtils.getInstance().saveException(pageContext, e);
             throw e;
         }
 
         return (present == desired);
-
     }
 
     /**
-     * Returns true if the bean given in the <code>name</code> attribute is found.
+     * Returns true if the bean given in the <code>name</code> attribute is
+     * found.
+     *
      * @since Struts 1.2
      */
     protected boolean isBeanPresent() {
         Object value = null;
+
         try {
             if (this.property != null) {
-                value = TagUtils.getInstance().lookup(pageContext, name, this.property, scope);
+                value =
+                    TagUtils.getInstance().lookup(pageContext, name,
+                        this.property, scope);
             } else {
                 value = TagUtils.getInstance().lookup(pageContext, name, scope);
             }
         } catch (JspException e) {
             value = null;
         }
-        
+
         return (value != null);
     }
 
     /**
      * Returns true if the cookie is present in the request.
+     *
      * @since Struts 1.2
      */
     protected boolean isCookiePresent(HttpServletRequest request) {
-        Cookie cookies[] = request.getCookies();
+        Cookie[] cookies = request.getCookies();
+
         if (cookies == null) {
             return false;
         }
-        
+
         for (int i = 0; i < cookies.length; i++) {
             if (this.cookie.equals(cookies[i].getName())) {
                 return true;
@@ -143,6 +146,4 @@
 
         return false;
     }
-
-
 }

Modified: struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/RedirectTag.java
URL: http://svn.apache.org/viewcvs/struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/RedirectTag.java?rev=376842&r1=376841&r2=376842&view=diff
==============================================================================
--- struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/RedirectTag.java (original)
+++ struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/RedirectTag.java Fri Feb 10 13:02:03 2006
@@ -1,40 +1,48 @@
 /*
- * $Id$ 
+ * $Id$
  *
  * Copyright 2000-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.taglib.logic;
 
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
+import org.apache.struts.taglib.TagUtils;
+import org.apache.struts.util.MessageResources;
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.TagSupport;
 
-import org.apache.struts.util.MessageResources;
-import org.apache.struts.taglib.TagUtils;
+import java.io.IOException;
+
+import java.net.MalformedURLException;
+
+import java.util.Map;
 
 /**
  * Generate a URL-encoded redirect to the specified URI.
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2004-10-16 12:38:42 -0400 (Sat, 16 Oct 2004)
+ *          $
  */
 public class RedirectTag extends TagSupport {
+    /**
+     * The message resources for this package.
+     */
+    protected static MessageResources messages =
+        MessageResources.getMessageResources(
+            "org.apache.struts.taglib.logic.LocalStrings");
 
     // ------------------------------------------------------------- Properties
 
@@ -43,6 +51,80 @@
      */
     protected String anchor = null;
 
+    /**
+     * The logical forward name from which to retrieve the redirect URI.
+     */
+    protected String forward = null;
+
+    /**
+     * The redirect URI.
+     */
+    protected String href = null;
+
+    /**
+     * The JSP bean name for query parameters.
+     */
+    protected String name = null;
+
+    /**
+     * The module-relative page URL (beginning with a slash) to which this
+     * redirect will be rendered.
+     */
+    protected String page = null;
+
+    /**
+     * The module-relative action (beginning with a slash) which will be
+     * called by this link
+     */
+    protected String action = null;
+
+    /**
+     * The module prefix (beginning with a slash) which will be used to find
+     * the action for this link.
+     */
+    protected String module = null;
+
+    /**
+     * The single-parameter request parameter name to generate.
+     */
+    protected String paramId = null;
+
+    /**
+     * The single-parameter JSP bean name.
+     */
+    protected String paramName = null;
+
+    /**
+     * The single-parameter JSP bean property.
+     */
+    protected String paramProperty = null;
+
+    /**
+     * The single-parameter JSP bean scope.
+     */
+    protected String paramScope = null;
+
+    /**
+     * The JSP bean property name for query parameters.
+     */
+    protected String property = null;
+
+    /**
+     * The scope of the bean specified by the name property, if any.
+     */
+    protected String scope = null;
+
+    /**
+     * Include our transaction control token?
+     */
+    protected boolean transaction = false;
+
+    /**
+     * Use character encoding from ServletResponse#getCharacterEncoding to get
+     * bytes of the url string for urlencoding?
+     */
+    protected boolean useLocalEncoding = false;
+
     public String getAnchor() {
         return (this.anchor);
     }
@@ -51,11 +133,6 @@
         this.anchor = anchor;
     }
 
-    /**
-     * The logical forward name from which to retrieve the redirect URI.
-     */
-    protected String forward = null;
-
     public String getForward() {
         return (this.forward);
     }
@@ -64,11 +141,6 @@
         this.forward = forward;
     }
 
-    /**
-     * The redirect URI.
-     */
-    protected String href = null;
-
     public String getHref() {
         return (this.href);
     }
@@ -77,18 +149,6 @@
         this.href = href;
     }
 
-    /**
-     * The message resources for this package.
-     */
-    protected static MessageResources messages =
-        MessageResources.getMessageResources(
-            "org.apache.struts.taglib.logic.LocalStrings");
-
-    /**
-     * The JSP bean name for query parameters.
-     */
-    protected String name = null;
-
     public String getName() {
         return (this.name);
     }
@@ -97,12 +157,6 @@
         this.name = name;
     }
 
-    /**
-     * The module-relative page URL (beginning with a slash) to which
-     * this redirect will be rendered.
-     */
-    protected String page = null;
-
     public String getPage() {
         return (this.page);
     }
@@ -111,12 +165,6 @@
         this.page = page;
     }
 
-    /**
-     * The module-relative action (beginning with a slash) which will be
-     * called by this link
-     */
-    protected String action = null;
-
     public String getAction() {
         return (this.action);
     }
@@ -125,25 +173,13 @@
         this.action = action;
     }
 
+    public String getModule() {
+        return (this.module);
+    }
 
-	/**
-	 * The module prefix (beginning with a slash) which will be
-	 * used to find the action for this link.
-	 */
-	protected String module = null;
-
-	public String getModule() {
-		return (this.module);
-	}
-
-	public void setModule(String module) {
-		this.module = module;
-	}
-
-    /**
-     * The single-parameter request parameter name to generate.
-     */
-    protected String paramId = null;
+    public void setModule(String module) {
+        this.module = module;
+    }
 
     public String getParamId() {
         return (this.paramId);
@@ -153,11 +189,6 @@
         this.paramId = paramId;
     }
 
-    /**
-     * The single-parameter JSP bean name.
-     */
-    protected String paramName = null;
-
     public String getParamName() {
         return (this.paramName);
     }
@@ -166,11 +197,6 @@
         this.paramName = paramName;
     }
 
-    /**
-     * The single-parameter JSP bean property.
-     */
-    protected String paramProperty = null;
-
     public String getParamProperty() {
         return (this.paramProperty);
     }
@@ -179,11 +205,6 @@
         this.paramProperty = paramProperty;
     }
 
-    /**
-     * The single-parameter JSP bean scope.
-     */
-    protected String paramScope = null;
-
     public String getParamScope() {
         return (this.paramScope);
     }
@@ -192,11 +213,6 @@
         this.paramScope = paramScope;
     }
 
-    /**
-     * The JSP bean property name for query parameters.
-     */
-    protected String property = null;
-
     public String getProperty() {
         return (this.property);
     }
@@ -205,11 +221,6 @@
         this.property = property;
     }
 
-    /**
-     * The scope of the bean specified by the name property, if any.
-     */
-    protected String scope = null;
-
     public String getScope() {
         return (this.scope);
     }
@@ -218,11 +229,6 @@
         this.scope = scope;
     }
 
-    /**
-     * Include our transaction control token?
-     */
-    protected boolean transaction = false;
-
     public boolean getTransaction() {
         return (this.transaction);
     }
@@ -231,83 +237,59 @@
         this.transaction = transaction;
     }
 
-	/**
-	 * Use character encoding from ServletResponse#getCharacterEncoding
-	 * to get bytes of the url string for urlencoding?
-	 */
-	protected boolean useLocalEncoding = false;
-    
-	public boolean isUseLocalEncoding() {
-	   return useLocalEncoding;
-	}
-
-	public void setUseLocalEncoding(boolean b) {
-	   useLocalEncoding = b;
-	}
+    public boolean isUseLocalEncoding() {
+        return useLocalEncoding;
+    }
+
+    public void setUseLocalEncoding(boolean b) {
+        useLocalEncoding = b;
+    }
 
     // --------------------------------------------------------- Public Methods
 
     /**
      * Defer generation until the end of this tag is encountered.
      *
-     * @exception JspException if a JSP exception has occurred
+     * @throws JspException if a JSP exception has occurred
      */
     public int doStartTag() throws JspException {
-
         return (SKIP_BODY);
-
     }
 
     /**
      * Render the redirect and skip the remainder of this page.
      *
-     * @exception JspException if a JSP exception has occurred
+     * @throws JspException if a JSP exception has occurred
      */
     public int doEndTag() throws JspException {
-
         this.doRedirect(this.generateRedirectURL());
 
         return (SKIP_PAGE);
-
     }
 
     /**
      * Calculate the url to redirect to.
+     *
      * @throws JspException
      * @since Struts 1.2
      */
-    protected String generateRedirectURL() throws JspException {
+    protected String generateRedirectURL()
+        throws JspException {
         Map params =
-            TagUtils.getInstance().computeParameters(
-                pageContext,
-                paramId,
-                paramName,
-                paramProperty,
-                paramScope,
-                name,
-                property,
-                scope,
+            TagUtils.getInstance().computeParameters(pageContext, paramId,
+                paramName, paramProperty, paramScope, name, property, scope,
                 transaction);
 
         String url = null;
+
         try {
-            url =
-                TagUtils.getInstance().computeURLWithCharEncoding(
-                    pageContext,
-                    forward,
-                    href,
-                    page,
-                    action,
-                    module,
-                    params,
-                    anchor,
-                    true,
+            url = TagUtils.getInstance().computeURLWithCharEncoding(pageContext,
+                    forward, href, page, action, module, params, anchor, true,
                     useLocalEncoding);
-
         } catch (MalformedURLException e) {
             TagUtils.getInstance().saveException(pageContext, e);
-            throw new JspException(
-                messages.getMessage("redirect.url", e.toString()));
+            throw new JspException(messages.getMessage("redirect.url",
+                    e.toString()));
         }
 
         return url;
@@ -315,17 +297,18 @@
 
     /**
      * Redirect to the given url converting exceptions to JspException.
+     *
      * @param url The path to redirect to.
      * @throws JspException
      * @since Struts 1.2
      */
-    protected void doRedirect(String url) throws JspException {
+    protected void doRedirect(String url)
+        throws JspException {
         HttpServletResponse response =
             (HttpServletResponse) pageContext.getResponse();
 
         try {
             response.sendRedirect(url);
-
         } catch (IOException e) {
             TagUtils.getInstance().saveException(pageContext, e);
             throw new JspException(e.getMessage());
@@ -336,7 +319,6 @@
      * Release any acquired resources.
      */
     public void release() {
-
         super.release();
         anchor = null;
         forward = null;
@@ -350,7 +332,5 @@
         paramScope = null;
         property = null;
         scope = null;
-
     }
-
 }

Modified: struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/package.html
URL: http://svn.apache.org/viewcvs/struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/package.html?rev=376842&r1=376841&r2=376842&view=diff
==============================================================================
--- struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/package.html (original)
+++ struts/taglib/trunk/src/java/org/apache/struts/taglib/logic/package.html Fri Feb 10 13:02:03 2006
@@ -1,34 +1,38 @@
 <body>
 
 <p>The "struts-logic" 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.
+    conditional generation of output text, looping over object collections
+    for repetitive generation of output text, and application flow management.
 </p>
 <a name="doc.Description"></a>
 
-<p>  </p>
-<div align="Center"> <a href="#doc.Introduction">[Introduction]</a>
- <a href="#doc.Functionality">[Logic   Functionality]</a>
- <a href="#doc.Properties">[Logic Properties]</a>
- <a href="#doc.Examples">[Logic   Examples]</a>
- </div>
+<p></p>
+
+<div align="Center"><a href="#doc.Introduction">[Introduction]</a>
+    <a href="#doc.Functionality">[Logic Functionality]</a>
+    <a href="#doc.Properties">[Logic Properties]</a>
+    <a href="#doc.Examples">[Logic Examples]</a>
+</div>
 
 <p></p>
 
-<hr /=""> <a name="doc.Intro"></a>
+<hr/=""> <a name="doc.Intro"></a>
 
 <h3>Introduction<a name="doc.Introduction"></a>
 </h3>
 
-<p>     The Logic library supplies tags that are useful for manipulating
-presentation logic     without the use of scriptlets.</p>
+<p> The Logic library supplies tags that are useful for manipulating
+    presentation logic without the use of scriptlets.</p>
+
 <p><br>
 </p>
-<div align="Center"><img src="doc-files/logicUML.gif" alt="Logic Tag UML" >
-<br>
-   </div>
+
+<div align="Center"><img src="doc-files/logicUML.gif" alt="Logic Tag UML">
+    <br>
+</div>
+
 <p></p>
-   <a name="doc.Functionality"></a>
+<a name="doc.Functionality"></a>
 
 <h3>Logic Tag Functionality<a name="doc.Functionality"></a>
 </h3>
@@ -36,47 +40,53 @@
 <p> The functionality of the logic tags can be divided into four groups:</p>
 
 <p><b>Value Comparisons -</b> The purpose of these tags is to print out the
-body   of the tag if the comparison evaluates to <i>true. </i></p>
+    body of the tag if the comparison evaluates to <i>true. </i></p>
 
 <ul>
-   <li><b><a href="../../../../../../userGuide/struts-logic.html#equal">equal,</a>
- <a href="../../../../../../userGuide/struts-logic.html#notEqual">notEqual</a>
-    </b>   </li>
-   <li><b><a href="../../../../../../userGuide/struts-logic.html#greaterEqual">greaterEqual</a>
-, <a href="../../../../../../userGuide/struts-logic.html#lessEqual">lessEqual</a>
+    <li><b><a href="../../../../../../userGuide/struts-logic.html#equal">equal,</a>
+        <a href="../../../../../../userGuide/struts-logic.html#notEqual">notEqual</a>
     </b></li>
-   <li><b><a href="../../../../../../userGuide/struts-logic.html#greaterThan">greaterThan</a>
-,<a href="../../../../../../userGuide/struts-logic.html#lessThan">     lessThan</a>
+    <li><b><a
+            href="../../../../../../userGuide/struts-logic.html#greaterEqual">greaterEqual</a>
+        , <a href="../../../../../../userGuide/struts-logic.html#lessEqual">lessEqual</a>
+    </b></li>
+    <li><b><a
+            href="../../../../../../userGuide/struts-logic.html#greaterThan">greaterThan</a>
+        ,<a href="../../../../../../userGuide/struts-logic.html#lessThan">
+        lessThan</a>
     </b></li>
 
 </ul>
 
-<p><b>Substring Matching -</b> The purpose of these tags is to match substrings
-  inside of other Strings</p>
+<p><b>Substring Matching -</b> The purpose of these tags is to match
+    substrings
+    inside of other Strings</p>
 
 <ul>
-   <li><b><a href="../../../../../../userGuide/struts-logic.html#match">match</a>
-, <a href="../../../../../../userGuide/struts-logic.html#notMatch">notMatch</a>
+    <li><b><a
+            href="../../../../../../userGuide/struts-logic.html#match">match</a>
+        , <a href="../../../../../../userGuide/struts-logic.html#notMatch">notMatch</a>
     </b></li>
 
 </ul>
 
 <p><b>Presentation Location -</b> The purpose of these tags is to change
-the location   of the presentation page</p>
+    the location of the presentation page</p>
 
 <ul>
-   <li><a href="../../../../../../userGuide/struts-logic.html#forward"><b>forward</b></a>
-  </li>
-   <li><a href="../../../../../../userGuide/struts-logic.html#redirect"><b>redirect</b></a>
-  </li>
+    <li><a href="../../../../../../userGuide/struts-logic.html#forward"><b>forward</b></a>
+    </li>
+    <li><a href="../../../../../../userGuide/struts-logic.html#redirect"><b>redirect</b></a>
+    </li>
 
 </ul>
 
-<p><b>Collection Utilities -</b>The purpose of these tags is to handle Collections</p>
+<p><b>Collection Utilities -</b>The purpose of these tags is to handle
+    Collections</p>
 
 <ul>
-   <li><a href="../../../../../../userGuide/struts-logic.html#iterate"><b>iterate</b></a>
- </li>
+    <li><a href="../../../../../../userGuide/struts-logic.html#iterate"><b>iterate</b></a>
+    </li>
 
 </ul>
 
@@ -84,329 +94,441 @@
 </h3>
 
 <p>Each of the four groups of logic tags have a common set of attributes
-associated   with them. :</p>
+    associated with them. :</p>
 
 <blockquote>
-  <p><b>Value Comparisons</b> (equal, notEqual, greaterEqual, lessEqual,
-greaterThan,     lessThan, present, notPresent)</p>
+<p><b>Value Comparisons</b> (equal, notEqual, greaterEqual, lessEqual,
+    greaterThan, lessThan, present, notPresent)</p>
 
-  <p>Each of the value comparison tags takes a <i>value</i> and compares
-it to     the value of a comparison attribute. If the value given can be
-successfully     converted to a <i>float</i> or <i>double</i>, then a number
-comparison is     performed on the value given and the value of the comparison
-attribute. Otherwise     a String comparison is performed. You have to specify
-one of the comparison     attributes: <i>cookie</i>, <i>header</i>, <i>parameter</i>
-, <i>property</i>     or <i>name. </i>For each of the examples, the tag "<i>
-someComparisonTag"</i>can     be replaced by any of the value comparison
-tags.</p>
-
-  <ul>
-     <li>value - the value to which this tag is going to compare, used in
-conjunction       with one of the comparison attributes: <i>cookie</i>, <i>
-header</i>, <i>parameter</i>,       <i>and property</i> and/or <i>name. </i></li>
-     <li>cookie - the name of the cookie to compare to <i>value</i>
-
-      <ul>
-         <li>example:
-          <pre>&lt;logic:<i>someComparisonTag</i> value="someUserName" cookie="userName"&gt;<br>  User Logged In<br>&lt;/logic:<i>someComparisonTag</i>&gt;<br></pre>
-         </li>
-
-      </ul>
-     </li>
-     <li>header - the name of the HTTP header to compare to <i>value</i>
-
-      <ul>
-         <li>example:
-          <pre>&lt;logic:<i>someComparisonTag</i> value="en_US" header="Accept-Language"&gt;<br>  Welcome English-speaking User*<br>&lt;/logic:<i>someComparisonTag</i>&gt;<br></pre>
-         </li>
-         <li>
-          <p>*Note: See the section in the user's guide on <a href="../../../../../../userGuide/building_view.html#i18n">
-Internationalized             Messages</a>
- to do things like this better.</p>
-         </li>
-
-      </ul>
-     </li>
-     <li>name - the variable to be compared to <i>value</i> is the JSP bean
-specified       by this attribute, if property is not specified, or the value
-of the specified       property of this bean, if property is specified.
-
-      <ul>
-         <li>example:
-          <pre>&lt;%<br>  String testString = "pantalones";<br>  pageContext.setAttribute("testString", testString, PageContext.PAGE_SCOPE);<br>%&gt;<br>&lt;jsp:useBean id="testString" scope="page" type="java.lang.String" /&gt;<br>&lt;logic:<i>someComparisonTag</i> name="testString" value="pantalones"&gt;<br>  Usted tiene pantalones!<br>&lt;/logic:<i>someComparison</i>&gt;<br></pre>
-         </li>
-
-      </ul>
-     </li>
-     <li>parameter - the name of the request parameter to compare to <i>value</i>
-
-      <ul>
-         <li>example:
-          <pre>&lt;logic:<i>someComparisonTag</i> value="" parameter="username"&gt;<br>  Error: a username must be specified<br>&lt;/logic:<i>someComparisonTag</i>&gt;<br></pre>
-         </li>
-
-      </ul>
-     </li>
-     <li>property - the variable to be compared with <i>value</i> is the
-property       (of the bean specified by the name attribute) specified by
-this attribute.       The property reference can be simple, nested, and/or
-indexed. <i>property</i>       is used in conjunction with <i>name</i> to
-specify a property in the bean       specified by <i>name</i>. For the type
-of syntax used for property, see       the users guide on the Bean Tags.</li>
-     <li>scope - the bean scope within which to search for the bean named
-by the       name property, or "any scope" if not specified. Possible values
-are "page",       "request", "session", "application", or "any       scope"
-    </li>
-
-  </ul>
-
-  <p><b>Substring Matching</b> (match, notMatch)</p>
-
-  <p>The substring matching tags take all the same arguments as the value
-comparison     tags. You compare the String specified by <i>value</i> to
-any of the comparison     values you give it, specified by <i>cookie</i>,
-  <i>header</i>, <i>parameter</i>,     <i>property</i> or <i>name.</i> Note
-that in the examples, <i>matchTag</i>     corresponds either the <i>match
-  </i>or <i>notMatch</i> tag. Matching tags     also have an additional <i>
-location</i> attribute added:</p>
-
-  <ul>
-     <li>location - has two possible values, "start" and "end".       If
-"start", the substring is attempted to be matched at the beginning
-of the String, if "end", then the substring is attempted to be       matched
-to the end of the String
-      <ul>
-         <li>example:
-          <pre>&lt;logic:<i>matchTag</i> parameter="action" value="processLogin" location="start"&gt;<br>  Processing Login....<br>&lt;/logic:<i>matchTag</i>&gt;<br><br>In this example, a request parameter "action" was compared to see if<br>its value started with the String "processLogin". In this case,<br><i>matchTag</i> would have to be &lt;logic:match&gt;.<br></pre>
-         </li>
-
-      </ul>
-     </li>
-
-  </ul>
-
-  <p><b>Presentation Location</b> (forward, redirect)</p>
-
-  <p>The <i>redirect</i> tag is resposible for sending a re-direct to the
-client's     browser, complete with URL-rewriting if it's supported by the
-container. Its     attributes are consistent with the Struts HTML <a href="../../../../../../userGuide/struts-html.html#link"><code>
-link</code></a>
-     tag. The base URL is calculated based on which of the following attributes
+<p>Each of the value comparison tags takes a <i>value</i> and compares
+    it to the value of a comparison attribute. If the value given can be
+    successfully converted to a <i>float</i> or <i>double</i>, then a number
+    comparison is performed on the value given and the value of the comparison
+    attribute. Otherwise a String comparison is performed. You have to specify
+    one of the comparison attributes: <i>cookie</i>, <i>header</i>, <i>parameter</i>
+    , <i>property</i> or <i>name. </i>For each of the examples, the tag "<i>
+    someComparisonTag"</i>can be replaced by any of the value comparison
+    tags.</p>
+
+<ul>
+    <li>value - the value to which this tag is going to compare, used in
+        conjunction with one of the comparison attributes: <i>cookie</i>, <i>
+        header</i>, <i>parameter</i>, <i>and property</i> and/or <i>name. </i>
+    </li>
+    <li>cookie - the name of the cookie to compare to <i>value</i>
+
+        <ul>
+            <li>example:
+                <pre>&lt;logic:<i>someComparisonTag</i> value="someUserName"
+                    cookie="userName"&gt;<br> User Logged In<br>&lt;/logic:<i>someComparisonTag</i>&gt;
+                    <br></pre>
+            </li>
+
+        </ul>
+    </li>
+    <li>header - the name of the HTTP header to compare to <i>value</i>
+
+        <ul>
+            <li>example:
+                <pre>&lt;logic:<i>someComparisonTag</i> value="en_US"
+                    header="Accept-Language"&gt;<br> Welcome English-speaking
+                    User*<br>&lt;/logic:<i>someComparisonTag</i>&gt;<br></pre>
+            </li>
+            <li>
+                <p>*Note: See the section in the user's guide on <a
+                        href="../../../../../../userGuide/building_view.html#i18n">
+                    Internationalized Messages</a>
+                    to do things like this better.</p>
+            </li>
+
+        </ul>
+    </li>
+    <li>name - the variable to be compared to <i>value</i> is the JSP bean
+        specified by this attribute, if property is not specified, or the
+        value
+        of the specified property of this bean, if property is specified.
+
+        <ul>
+            <li>example:
+                <pre>&lt;%<br> String testString = "pantalones";<br>
+                    pageContext.setAttribute("testString", testString,
+                    PageContext.PAGE_SCOPE);<br>%&gt;<br>&lt;jsp:useBean
+                    id="testString" scope="page" type="java.lang.String" /&gt;
+                    <br>&lt;logic:<i>someComparisonTag</i> name="testString"
+                    value="pantalones"&gt;<br> Usted tiene pantalones!<br>&lt;/logic:<i>someComparison</i>&gt;
+                    <br></pre>
+            </li>
+
+        </ul>
+    </li>
+    <li>parameter - the name of the request parameter to compare to
+        <i>value</i>
+
+        <ul>
+            <li>example:
+                <pre>&lt;logic:<i>someComparisonTag</i> value=""
+                    parameter="username"&gt;<br> Error: a username must be
+                    specified<br>&lt;/logic:<i>someComparisonTag</i>&gt;<br>
+                </pre>
+            </li>
+
+        </ul>
+    </li>
+    <li>property - the variable to be compared with <i>value</i> is the
+        property (of the bean specified by the name attribute) specified by
+        this attribute. The property reference can be simple, nested, and/or
+        indexed. <i>property</i> is used in conjunction with <i>name</i> to
+        specify a property in the bean specified by <i>name</i>. For the type
+        of syntax used for property, see the users guide on the Bean Tags.
+    </li>
+    <li>scope - the bean scope within which to search for the bean named
+        by the name property, or "any scope" if not specified. Possible values
+        are "page", "request", "session", "application", or "any scope"
+    </li>
+
+</ul>
+
+<p><b>Substring Matching</b> (match, notMatch)</p>
+
+<p>The substring matching tags take all the same arguments as the value
+    comparison tags. You compare the String specified by <i>value</i> to
+    any of the comparison values you give it, specified by <i>cookie</i>,
+    <i>header</i>, <i>parameter</i>, <i>property</i> or <i>name.</i> Note
+    that in the examples, <i>matchTag</i> corresponds either the <i>match
+</i>or <i>notMatch</i> tag. Matching tags also have an additional <i>
+    location</i> attribute added:</p>
+
+<ul>
+    <li>location - has two possible values, "start" and "end". If
+        "start", the substring is attempted to be matched at the beginning
+        of the String, if "end", then the substring is attempted to be matched
+        to the end of the String
+        <ul>
+            <li>example:
+                <pre>&lt;logic:<i>matchTag</i> parameter="action"
+                    value="processLogin" location="start"&gt;<br> Processing
+                    Login....<br>&lt;/logic:<i>matchTag</i>&gt;<br><br>In this
+                    example, a request parameter "action" was compared to see
+                    if<br>its value started with the String "processLogin". In
+                    this case,<br><i>matchTag</i> would have to be &lt;logic:match&gt;.
+                    <br></pre>
+            </li>
+
+        </ul>
+    </li>
+
+</ul>
+
+<p><b>Presentation Location</b> (forward, redirect)</p>
+
+<p>The <i>redirect</i> tag is resposible for sending a re-direct to the
+    client's browser, complete with URL-rewriting if it's supported by the
+    container. Its attributes are consistent with the Struts HTML <a
+        href="../../../../../../userGuide/struts-html.html#link"><code>
+    link</code></a>
+    tag. The base URL is calculated based on which of the following attributes
     you specify (you must specify exactly one of them):</p>
 
-  <ul>
-     <li> forward - Use the value of this attribute as the name of a global
-ActionForward       to be looked up, and use the context-relative URI found
-there. </li>
-     <li>href - Use the value of this attribute unchanged. </li>
-     <li>page - Use the value of this attribute as a context-relative URI,
-and       generate a server-relative URI by including the context path. </li>
+<ul>
+    <li> forward - Use the value of this attribute as the name of a global
+        ActionForward to be looked up, and use the context-relative URI found
+        there. </li>
+    <li>href - Use the value of this attribute unchanged. </li>
+    <li>page - Use the value of this attribute as a context-relative URI,
+        and generate a server-relative URI by including the context
+        path. </li>
 
-  </ul>
+</ul>
 
-  <p>The <i>forward</i> tag is responsible for either redirecting or forwarding
+<p>The <i>forward</i> tag is responsible for either redirecting or forwarding
     to a specified global action forward. To define a global ActionForward,
-see     The <a href="../../../../../../userGuide/building_controller.html#config">
-Action     Mappings Configuration File</a>
-. You can specify whether the forward re-directs     or forwards when executed
-in the config file. The forward tag has one attribute:</p>
+    see The <a
+        href="../../../../../../userGuide/building_controller.html#config">
+    Action Mappings Configuration File</a>
+    . You can specify whether the forward re-directs or forwards when executed
+    in the config file. The forward tag has one attribute:</p>
 
-  <ul>
-     <li>name - The logical name of the ActionForward to use</li>
+<ul>
+    <li>name - The logical name of the ActionForward to use</li>
 
-  </ul>
+</ul>
 
-  <p><b>Collection Utilities</b> (iterate)</p>
+<p><b>Collection Utilities</b> (iterate)</p>
 
-  <p>The <i>iterate</i> tag is responsible for executing its body content
-once     for every element inside of the specified Collection. There is one
-required     attribute:</p>
+<p>The <i>iterate</i> tag is responsible for executing its body content
+    once for every element inside of the specified Collection. There is one
+    required attribute:</p>
 
-  <ul>
-     <li>id - The name of a page scope JSP bean that will contain the current
-element       of the collection on each iteration</li>
+<ul>
+    <li>id - The name of a page scope JSP bean that will contain the current
+        element of the collection on each iteration</li>
 
-  </ul>
+</ul>
 
-  <p>The other attributes allow for more flexibility on which Collection
-to iterate     and how to do it:</p>
+<p>The other attributes allow for more flexibility on which Collection
+    to iterate and how to do it:</p>
 
-  <ul>
-     <li>collection - a runtime expression that evaluates to a Collection
-to be       iterated
-      <ul>
-         <li>example:
-          <pre>&lt;%<br>  java.util.Vector vector = new java.util.Vector();<br>  vector.add(new Integer(12));<br>  vector.add(new Integer(5));<br> %&gt;<br></pre>
-         </li>
+<ul>
+    <li>collection - a runtime expression that evaluates to a Collection
+        to be iterated
+        <ul>
+            <li>example:
+                <pre>&lt;%<br> java.util.Vector vector = new
+                    java.util.Vector();<br> vector.add(new Integer(12));<br>
+                    vector.add(new Integer(5));<br> %&gt;<br></pre>
+            </li>
 
-      </ul>
-     </li>
+        </ul>
+    </li>
 
-  </ul>
+</ul>
 
-  <blockquote>
+<blockquote>
     <blockquote>
-      <pre>&lt;logic:iterate id="myCollectionElement" collection="&lt;%= vector %&gt;"&gt;<br><i> Do something with myCollectionElement</i>
-&lt;/logic:iterate&gt;
-</pre>
-     </blockquote>
-   </blockquote>
-
-      <ul>
-     <li>length - The maximum number of entries (from the underlying collection)
-      to be iterated through on this page. This can be either an integer
-that       directly expresses the desired value, or the name of a JSP bean
-(in any       scope) of type java.lang.Integer that defines the desired value.
-If not       present, there will be no limit on the number of iterations
-performed</li>
-     <li>name - The name of the JSP bean containing the collection to be
-iterated       (if property is not specified), or the JSP bean whose property
-getter returns       the collection to be iterated (if property is specified).
-
-          <ul>
-         <li>example:
-              <pre>&lt;%<br>
-    java.util.ArrayList list = new java.util.ArrayList();
-    list.add("First");
-    list.add("Second");
-    list.add("Third");
-    list.add("Fourth");
-    list.add("Fifth");
-    pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);
-%&gt;
-
-&lt;logic:iterate id="myCollectionElement" name="list"&gt;
-  <i>Do something with myCollectionElement</i>
-&lt;/logic:iterate&gt;</pre>
-         </li>
-
-          </ul>
-     </li>
-     <li>offset - The zero-relative index of the starting point at which
-entries       from the underlying collection will be iterated through. This
-can be either       an integer that directly expresses the desired value,
-or the name of a JSP       bean (in any scope) of type java.lang.Integer
-that defines the desired value.       If not present, zero is assumed (meaning
-that the collection will be iterated       from the beginning. </li>
-     <li>property - Name of the property, of the JSP bean specified by name,
-whose       getter returns the collection to be iterated. See the user's
-guide for the       bean tag library for the syntax of the property attribute</li>
-     <li>scope - The bean scope within which to search for the bean named
-by the       name property, or "any scope" if not specified. Possible values
-are "page",       "request", "session", "application", or "any       scope"
-        </li>
-     <li>type - Fully qualified Java class name of the element to be exposed
-through       the JSP bean named from the id attribute. If not present, no
-type conversions       will be performed. NOTE: The actual elements of the
-collection must be assignment-compatible       with this class, or a request
-time ClassCastException will occur.
-          <ul>
-         <li>example:
-              <pre>&lt;%    java.util.ArrayList list = new java.util.ArrayList();<br>list.add("First");<br>list.add("Second");<br>list.add("Third");<br>list.add("Fourth");<br>list.add("Fifth");<br>    pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);<br> %&gt;<br><br>&lt;logic:iterate id="myCollectionElement" name="list" type="java.lang.String"&gt;<br>  <i>Do something with myCollectionElement</i>
-&lt;/logic:iterate&gt;</pre>
-         </li>
-
-          </ul>
-     </li>
-
-      </ul>
- </blockquote>
-
-      <h3>Logic Examples<a name="doc.Examples"></a></h3>
-
-      <blockquote>
-        <p><b>Value Comparisons</b></p>
-
-        <blockquote>
-          <p><u></u><u></u><u>Logic Equivalence Tags (equal, notEqual, greaterEqual,
-      lessEqual, lessThan, greaterThan)</u></p>
-
-          <blockquote>
-            <p>You can compare these tags to the "==", "!=" ,"&gt;=",
-     "&lt;=", "&lt;", and "&gt;"logic operators         in most languages.
-Their usage is fairly straightforward for numbers.         For an example,
-we'll create a small "Guess That Number" game         that uses request parameters
-from a form input to play. The number will         be hardcoded as "7", because
-this is just an example. Note that         this is actually putting application
-logic inside of jsp pages, and isn't         the recommended development
-method for Struts. It's just an easy way to         show how these tags are
-used:</p>
-
-            <p>The first step is to develop the form that will call on the
-processing         jsp page. This form will use the "GET" method so that
-you can         see the request parameter in the URL. The POST method can
-also be used         with no problem or changes.</p>
-
-            <p>[numberGuess.jsp]</p>
-
-            <pre>&lt;form action="numberProcess.jsp" method="GET"&gt;<br>Please Enter a Number From 1-10: &lt;input type="text" name="number" /&gt;&lt;br /&gt;<br>  &lt;center&gt;<br>    &lt;input type="submit" name="Guess Number" /&gt;<br>  &lt;/center&gt;<br>&lt;/form&gt;<br></pre>
-       The next step is to create the processing page. It uses the struts-logic
-      taglib. For information on how to set this tag library up in your application
-      to use, see <a href="../../../../../../userGuide/configuration.html#dd_config">
-The       Web Application Deployment Descriptor</a>
-
-            <p>[numberProcess.jsp]</p>
-
-            <pre>&lt;%@ page language="java" %&gt;<br>&lt;%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %&gt;<br></pre>
-
-            <pre>&lt;!-- Is the number guess right? --&gt;<br>&lt;logic:equal parameter="number" value="7"&gt;<br>  You guessed right! You win a high speed blender!<br>&lt;/logic:equal&gt;<br></pre>
-
-            <pre>&lt;!-- If the number guessed was wrong --&gt;<br>&lt;logic:notEqual parameter="number" value="7"&gt;<br>  &lt;!-- Less Than --&gt;<br>  &lt;logic:lessThan parameter="number" value="7"&gt;<br>         A little higher...<br>  &lt;/logic:lessThan&gt;<br>  &lt;!-- Greater Than --&gt;<br>  &lt;logic:greaterThan parameter="number" value="7"&gt;<br>         A little lower...<br>  &lt;/logic:greaterThan&gt;<br>&lt;/logic:notEqual&gt;<br></pre>
-
-            <p>Basically, the numberProcess.jsp page uses the equal tag to
-check if         the guess is 7, and if so, prints out a congratulatory message.
-If the         number isn't equal, specified by the use of the &lt;logic:notEqual&gt;
-        tag, it uses the greaterThan and lessThan tags to check if the number
-        is higher or lower than 7, and prints out a hint. As said before,
-this         is a horribly designed small application, with no validity checks
-on the         number input, but shows the basic usage of the logic equal
-tags</p>
-
-            <p>For String comparisons, the equal tags use the java.lang.String.compareTo()
-        method. See the javadocs on the compareTo() method for more information,
-        located <a href="http://www.javasoft.com/products/jdk/1.2/docs/api/java/lang/String.html#compareTo%28java.lang.Object%29">
-here</a>
-.</p>
-     </blockquote>
-
-            <p><u>Match and Present Tags (match, notMatch, present, notPresent)</u></p>
-
-            <blockquote>
-              <p>You use the match tags in conjunction with the present tags
-in order         to do substring matches. For an example using this we'll
-use headers,         specifically the "Referer" header. The HTTP referer
-header gives         the URL of the document that refers to the requested
-URL. We'll use this         to check if the user is coming from a link specified
-by a <a href="http://www.google.com">Google</a>
-         search, and offer a personalized greeting, frightening users that
-find         our site through the search engine with our amazing intimate
-knowledge         of their browsing habits:</p>
-
-              <p>[sneaky.jsp]</p>
-
-              <pre>&lt;%@ page language="java" %&gt;<br>&lt;%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %&gt;<br><br><br>&lt;!-- Check to see if the "Referer" header is present --&gt;<br>&lt;logic:present header="Referer"&gt;<br>  &lt;logic:match header="Referer" value="google.com"&gt;<br>    I see you found our site through Google... interesting.<br>  &lt;/logic:match&gt;<br>  &lt;logic:notMatch header="Referer" value="google.com"&gt;<br>    Welcome to the site, we're secretly logging what site you came from,<br>    because we're shady...<br>  &lt;/logic:notMatch&gt;<br>&lt;/logic:present&gt;<br><br>&lt;!-- If the header is not present --&gt;<br>&lt;logic:notPresent header="Referer"&gt;<br>  Hi, welcome to our site.  Please fill out our<br>  &lt;a href="nonExistantForm.jsp"&gt;Form&lt;/a&gt; and<br>  tell us where you're coming from.<br>&lt;/logic:notPresent&gt;</pre>
-
-              <p>Note: Another interesting usage of these tags and headers
-would be to         use the "User-Agent" header to display browser-specific
-javascript.</p>
-     </blockquote>
-   </blockquote>
-
-              <p><b>Collection Utilities (iterate)</b></p>
-
-              <blockquote>
-                <p>For an example of using the &lt;logic:iterate&gt; tag,
-we'll use one of       the previous examples given, in it's entirety. This
-example uses the &lt;bean:write&gt;       tag from the Bean Tag Library,
-see the User's Guide on the bean tag library       for more information on
-it's usage:</p>
-
-                <p>[iterate.jsp]</p>
-
-                <pre>&lt;%@ page language="java" %&gt;<br>&lt;%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %&gt;<br>&lt;%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %&gt;<br></pre>
-
-                <pre>&lt;%<br>java.util.ArrayList list = new java.util.ArrayList();<br>  list.add("First");<br>  list.add("Second");<br>  list.add("Third");<br>  list.add("Fourth");<br>  list.add("Fifth");<br>  pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);<br>%&gt;<br><br>&lt;logic:iterate id="myCollectionElement" name="list"&gt;<br>  Element Value: &lt;bean:write name="myCollectionElement" /&gt;&lt;br /&gt;<br>&lt;/logic:iterate&gt;</pre>
- </blockquote>
- </blockquote>
+        <pre>&lt;logic:iterate id="myCollectionElement" collection="&lt;%=
+            vector %&gt;"&gt;<br><i> Do something with myCollectionElement</i>
+            &lt;/logic:iterate&gt;
+        </pre>
+    </blockquote>
+</blockquote>
+
+<ul>
+    <li>length - The maximum number of entries (from the underlying
+        collection)
+        to be iterated through on this page. This can be either an integer
+        that directly expresses the desired value, or the name of a JSP bean
+        (in any scope) of type java.lang.Integer that defines the desired
+        value.
+        If not present, there will be no limit on the number of iterations
+        performed</li>
+    <li>name - The name of the JSP bean containing the collection to be
+        iterated (if property is not specified), or the JSP bean whose
+        property
+        getter returns the collection to be iterated (if property is
+        specified).
+
+        <ul>
+            <li>example:
+                <pre>&lt;%<br>
+                    java.util.ArrayList list = new java.util.ArrayList();
+                    list.add("First");
+                    list.add("Second");
+                    list.add("Third");
+                    list.add("Fourth");
+                    list.add("Fifth");
+                    pageContext.setAttribute("list", list,
+                    PageContext.PAGE_SCOPE);
+                    %&gt;
+
+                    &lt;logic:iterate id="myCollectionElement" name="list"&gt;
+                    <i>Do something with myCollectionElement</i>
+                    &lt;/logic:iterate&gt;</pre>
+            </li>
+
+        </ul>
+    </li>
+    <li>offset - The zero-relative index of the starting point at which
+        entries from the underlying collection will be iterated through. This
+        can be either an integer that directly expresses the desired value,
+        or the name of a JSP bean (in any scope) of type java.lang.Integer
+        that defines the desired value. If not present, zero is assumed
+        (meaning
+        that the collection will be iterated from the beginning. </li>
+    <li>property - Name of the property, of the JSP bean specified by name,
+        whose getter returns the collection to be iterated. See the user's
+        guide for the bean tag library for the syntax of the property
+        attribute</li>
+    <li>scope - The bean scope within which to search for the bean named
+        by the name property, or "any scope" if not specified. Possible values
+        are "page", "request", "session", "application", or "any scope"
+    </li>
+    <li>type - Fully qualified Java class name of the element to be exposed
+        through the JSP bean named from the id attribute. If not present, no
+        type conversions will be performed. NOTE: The actual elements of the
+        collection must be assignment-compatible with this class, or a request
+        time ClassCastException will occur.
+        <ul>
+            <li>example:
+                <pre>&lt;% java.util.ArrayList list = new
+                    java.util.ArrayList();<br>list.add("First");<br>
+                    list.add("Second");<br>list.add("Third");<br>
+                    list.add("Fourth");<br>list.add("Fifth");<br>
+                    pageContext.setAttribute("list", list,
+                    PageContext.PAGE_SCOPE);<br> %&gt;<br><br>&lt;logic:iterate
+                    id="myCollectionElement" name="list"
+                    type="java.lang.String"&gt;<br>  <i>Do something with
+                    myCollectionElement</i>
+                    &lt;/logic:iterate&gt;</pre>
+            </li>
+
+        </ul>
+    </li>
+
+</ul>
+</blockquote>
+
+<h3>Logic Examples<a name="doc.Examples"></a></h3>
+
+<blockquote>
+<p><b>Value Comparisons</b></p>
+
+<blockquote>
+<p><u></u><u></u><u>Logic Equivalence Tags (equal, notEqual,
+    greaterEqual,
+    lessEqual, lessThan, greaterThan)</u></p>
+
+<blockquote>
+    <p>You can compare these tags to the "==", "!=" ,"&gt;=",
+        "&lt;=", "&lt;", and "&gt;"logic operators in most languages.
+        Their usage is fairly straightforward for numbers. For an
+        example,
+        we'll create a small "Guess That Number" game that uses
+        request parameters
+        from a form input to play. The number will be hardcoded as
+        "7", because
+        this is just an example. Note that this is actually putting
+        application
+        logic inside of jsp pages, and isn't the recommended
+        development
+        method for Struts. It's just an easy way to show how these
+        tags are
+        used:</p>
+
+    <p>The first step is to develop the form that will call on the
+        processing jsp page. This form will use the "GET" method so
+        that
+        you can see the request parameter in the URL. The POST method
+        can
+        also be used with no problem or changes.</p>
+
+    <p>[numberGuess.jsp]</p>
+
+    <pre>&lt;form action="numberProcess.jsp" method="GET"&gt;<br>
+        Please Enter a Number From 1-10: &lt;input type="text"
+        name="number" /&gt;&lt;br /&gt;<br> &lt;center&gt;<br> &lt;input
+        type="submit" name="Guess Number" /&gt;<br> &lt;/center&gt;
+        <br>&lt;/form&gt;<br></pre>
+    The next step is to create the processing page. It uses the
+    struts-logic
+    taglib. For information on how to set this tag library up in your
+    application
+    to use, see <a
+        href="../../../../../../userGuide/configuration.html#dd_config">
+    The Web Application Deployment Descriptor</a>
+
+    <p>[numberProcess.jsp]</p>
+
+    <pre>&lt;%@ page language="java" %&gt;<br>&lt;%@ taglib
+        uri="/WEB-INF/struts-logic.tld" prefix="logic" %&gt;<br></pre>
+
+    <pre>&lt;!-- Is the number guess right? --&gt;<br>&lt;logic:equal
+        parameter="number" value="7"&gt;<br> You guessed right! You
+        win a high speed blender!<br>&lt;/logic:equal&gt;<br></pre>
+
+    <pre>&lt;!-- If the number guessed was wrong --&gt;<br>&lt;logic:notEqual
+        parameter="number" value="7"&gt;<br> &lt;!-- Less Than --&gt;
+        <br> &lt;logic:lessThan parameter="number" value="7"&gt;<br> A
+        little higher...<br> &lt;/logic:lessThan&gt;<br> &lt;!--
+        Greater Than --&gt;<br> &lt;logic:greaterThan
+        parameter="number" value="7"&gt;<br> A little lower...<br>
+        &lt;/logic:greaterThan&gt;<br>&lt;/logic:notEqual&gt;<br>
+    </pre>
+
+    <p>Basically, the numberProcess.jsp page uses the equal tag to
+        check if the guess is 7, and if so, prints out a
+        congratulatory message.
+        If the number isn't equal, specified by the use of the &lt;logic:notEqual&gt;
+        tag, it uses the greaterThan and lessThan tags to check if the
+        number
+        is higher or lower than 7, and prints out a hint. As said
+        before,
+        this is a horribly designed small application, with no
+        validity checks
+        on the number input, but shows the basic usage of the logic
+        equal
+        tags</p>
+
+    <p>For String comparisons, the equal tags use the
+        java.lang.String.compareTo()
+        method. See the javadocs on the compareTo() method for more
+        information,
+        located <a
+            href="http://www.javasoft.com/products/jdk/1.2/docs/api/java/lang/String.html#compareTo%28java.lang.Object%29">
+        here</a>
+        .</p>
+</blockquote>
+
+<p><u>Match and Present Tags (match, notMatch, present,
+    notPresent)</u></p>
+
+<blockquote>
+    <p>You use the match tags in conjunction with the present tags
+        in order to do substring matches. For an example using this
+        we'll
+        use headers, specifically the "Referer" header. The HTTP
+        referer
+        header gives the URL of the document that refers to the
+        requested
+        URL. We'll use this to check if the user is coming from a link
+        specified
+        by a <a href="http://www.google.com">Google</a>
+        search, and offer a personalized greeting, frightening users
+        that
+        find our site through the search engine with our amazing
+        intimate
+        knowledge of their browsing habits:</p>
+
+    <p>[sneaky.jsp]</p>
+
+    <pre>&lt;%@ page language="java" %&gt;<br>&lt;%@ taglib
+        uri="/WEB-INF/struts-logic.tld" prefix="logic" %&gt;<br><br>
+        <br>&lt;!-- Check to see if the "Referer" header is present --&gt;
+        <br>&lt;logic:present header="Referer"&gt;<br> &lt;logic:match
+        header="Referer" value="google.com"&gt;<br> I see you found
+        our site through Google... interesting.<br> &lt;/logic:match&gt;
+        <br> &lt;logic:notMatch header="Referer" value="google.com"&gt;
+        <br> Welcome to the site, we're secretly logging what site you
+        came from,<br> because we're shady...<br> &lt;/logic:notMatch&gt;
+        <br>&lt;/logic:present&gt;<br><br>&lt;!-- If the header is not
+        present --&gt;<br>&lt;logic:notPresent header="Referer"&gt;
+        <br> Hi, welcome to our site. Please fill out our<br> &lt;a
+        href="nonExistantForm.jsp"&gt;Form&lt;/a&gt; and<br> tell us
+        where you're coming from.<br>&lt;/logic:notPresent&gt;</pre>
+
+    <p>Note: Another interesting usage of these tags and headers
+        would be to use the "User-Agent" header to display
+        browser-specific
+        javascript.</p>
+</blockquote>
+</blockquote>
+
+<p><b>Collection Utilities (iterate)</b></p>
+
+<blockquote>
+    <p>For an example of using the &lt;logic:iterate&gt; tag,
+        we'll use one of the previous examples given, in it's entirety.
+        This
+        example uses the &lt;bean:write&gt; tag from the Bean Tag Library,
+        see the User's Guide on the bean tag library for more information
+        on
+        it's usage:</p>
+
+    <p>[iterate.jsp]</p>
+
+    <pre>&lt;%@ page language="java" %&gt;<br>&lt;%@ taglib
+        uri="/WEB-INF/struts-bean.tld" prefix="bean" %&gt;<br>&lt;%@
+        taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %&gt;<br>
+    </pre>
+
+    <pre>&lt;%<br>java.util.ArrayList list = new java.util.ArrayList();
+        <br> list.add("First");<br> list.add("Second");<br>
+        list.add("Third");<br> list.add("Fourth");<br> list.add("Fifth");
+        <br> pageContext.setAttribute("list", list,
+        PageContext.PAGE_SCOPE);<br>%&gt;<br><br>&lt;logic:iterate
+        id="myCollectionElement" name="list"&gt;<br> Element Value: &lt;bean:write
+        name="myCollectionElement" /&gt;&lt;br /&gt;<br>&lt;/logic:iterate&gt;
+    </pre>
+</blockquote>
+</blockquote>
 
 </body>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org