title: logic:present not working as expected
body: <p>I've condensed the code to its barest essentials to illustrate my problem as clearly as I can.</p>
  
  <p>I hope the formatting turns out ok - this is my first post with stackoverflow and no matter what I did, indent 4 spaces or use ctrl-K, the compiler was not happy.</p>
  
  <p>My addAssignment.jsp is showing the header "Messages" when the LinkedList should be, and appears to be, empty. If there are no messages in the LinkedList, I expect the logic:present tag to preclude the printing of the header "Messages". How do I prevent the header "Messages" from printing if there are no messages in the LinkedList? </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /&gt;
    &lt;title&gt;Add Assignment Page&lt;/title&gt;
    &lt;style type="text/css"&gt;table { margin-left:5%; }&lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;table&gt;
      &lt;tr&gt;
        &lt;td&gt;
          &lt;logic:present name="messages"&gt;
            &lt;h3&gt;Messages:&lt;/h3&gt;
            &lt;logic:iterate id="msg" name="messages"&gt;
              &lt;bean:write name="msg" /&gt;&lt;br /&gt;
            &lt;/logic:iterate&gt;
          &lt;/logic:present&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
    &lt;table&gt;
      &lt;tr&gt;
        &lt;td&gt;
          &lt;H1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Add Assignment&lt;/H1&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
    &lt;html:form action="addAssignmentAction" focus="injuredWorkersFirstName"&gt;
      &lt;table&gt;
        &lt;tr&gt;
          &lt;td&gt;First name&lt;/td&gt;
          &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
              &lt;html:text property="injuredWorkersFirstName" /&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td class="100PixCentered"&gt;&amp;nbsp;&lt;/td&gt;
          &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
              &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
              &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;html:submit&gt;submit&lt;/html:submit&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/html:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The LoginAction file illustrates how I use the LinkedList. Also, the LoginAction works correctly with the Login.jsp page, the LinkedList and the Logic and Bean tags. That is, when error messages were present in the LinkedList, the Login.jsp page showed them corretly under the header Messages. </p>
  
  <pre><code>public class LoginAction extends Action {
  
      public void execute(Object data) { }
  
      public ActionForward execute(ActionMapping mapping, ActionForm form, 
               HttpServletRequest request, HttpServletResponse response) throws Exception {
  
          LinkedList messages = new LinkedList();
          String returnValue = "success";
  
          if ((((LoginForm) form).getName() == null) 
                  || ((((LoginForm) form).getName()).length() == 0)) {
              messages.add("bad name");
              returnValue = "error";
          }
  
          if ((((LoginForm) form).getPassword() == null) 
                  || ((((LoginForm) form).getPassword()).length() == 0)) {
              messages.add("bad password");
              returnValue = "error";
          }
  
          request.setAttribute("messages", messages);
          return mapping.findForward(returnValue);
      }
  }
  </code></pre>
  
  <p>Struts configuration:</p>
  
  <pre><code>&lt;struts-config&gt;
    &lt;data-sources&gt;&lt;/data-sources&gt;
    &lt;!-- ========== Form Bean Definitions =================================== --&gt;
    &lt;form-beans&gt;
      &lt;form-bean name="loginForm" type="package1.LoginForm" /&gt;
      &lt;form-bean name="AddAssignmentForm" type="package1.AddAssignmentForm" /&gt;
    &lt;/form-beans&gt;
    &lt;!-- ========== Action Mapping Definitions ============================== --&gt;
    &lt;!-- Action Mappings Configuration --&gt;
    &lt;action-mappings&gt;
      &lt;action path="/login" type="package1.LoginAction" name="loginForm" 
          scope="request" validate="false" input="/index.jsp"&gt;
        &lt;forward name="success" path="/addAssignment.jsp"&gt;&lt;/forward&gt;
        &lt;forward name="error" path="/index.jsp"&gt;&lt;/forward&gt;
      &lt;/action&gt;
      &lt;action path="/addAssignmentAction" type="assignment.AddAssignmentAction" 
          name="AddAssignmentForm" scope="request" validate="false" 
          input="/addAssignment.jsp"&gt;
        &lt;forward name="success" path="/mainMenu.jsp"&gt;&lt;/forward&gt;
        &lt;forward name="error" path="/addAssignment.jsp"&gt;&lt;/forward&gt;
      &lt;/action&gt;
    &lt;/action-mappings&gt;
    &lt;!-- ========== Message Resources Definitions =========================== --&gt;
  &lt;/struts-config&gt;
  </code></pre>