title: Write Static Content With JSTL
body: <p>Working on a program and trying to print a static integer from another class. The weird thing is I can do it with scriptlets, but not with JSTL.  Check out the error checking code I just wrote.</p>
  
  <pre><code>Comments: &lt;%=Comments.getCommentCount() %&gt; &lt;br /&gt;
  Comments: ${Comments.getCommentCount()} &lt;br /&gt;
  Comments: &lt;c:out value="${Comments.getCommentCount()}" /&gt; &lt;br /&gt;
  Comments: &lt;c:out value="1" /&gt;
  </code></pre>
  
  <p>This gives me an HTML output of</p>
  
  <pre><code>Comments: 5 &lt;br /&gt;
  Comments:  &lt;br /&gt;
  Comments:  &lt;br /&gt;
  Comments: 1
  </code></pre>
  
  <p>So as you can see only the first and last lines of code work. How can I print out this static variable without scriptlets?</p>
  
  <p>And in my header I have</p>
  
  <pre><code>import="org.test.Comments"
  </code></pre>
  
  <p>Comments.java</p>
  
  <pre><code>package org.test;
  
  import java.util.ArrayList;
  import java.util.Collections;
  
  public class Comments 
  {
      private String name = "";
      private String comment = "";
      private static ArrayList&lt;String&gt; allComments = new ArrayList&lt;String&gt;();
  
  
      public void setNewComment(String name, String comment)
      {
          this.name = name;
          this.comment = comment;
          allComments.add(getComment());
      }
  
      public static ArrayList&lt;String&gt; getCommentList()
      {
          Collections.reverse(allComments);
          return allComments;
      }
  
  
      public static int getCommentCount()
      {
          return allComments.size();
      }
  
  
      public String getComment()
      {
          return String.format("Name:   %s &lt;br /&gt;Comment:  %s &lt;p&gt;&lt;hr /&gt;&lt;/p&gt;", name, comment);
      }
  }
  </code></pre>